ProductFlashSale
Overview
ProductFlashSale is a Flash Sale plugin for GP247 store systems. It lets you:
- Configure time-based promotional prices per product.
- Manage Flash Sale inventory independently (stock/sold) and display order (sort).
- Display Flash Sale products on a dedicated page and as a homepage block.
Requirements
- Required:
gp247/shop
.
Key features
- Admin:
- Dedicated admin screen to add/edit/delete Flash Sale configurations per product.
- Fields:
product_id
,stock
,sold
,sort
,price_promotion
,date_start
,date_end
,status_promotion
. - Auto create/sync the promotion record (
shop_product_promotion
) on create/update. - Creates its own data table
shop_product_flash
on install.
- Front-end:
- Listing page: route name
product_flash_sale.index
(URL:/plugin/product_flash_sale/index
, multilingual ifGP247_SEO_LANG
is enabled). - Block shows countdown timer, sold/stock progress bar, and promotional price.
- Only displays items within the promo time window, in stock, and with promotion enabled.
- Listing page: route name
- Helpers:
gp247_product_flash($limit = 8, $paginate = false)
— fetch Flash Sale products.gp247_product_flash_check_over($productId, $quantity)
— check remaining quantity.gp247_product_flash_update_stock($productId, $quantity)
— increase sold quantity.
Processing logic
- Before an order is created: system checks remaining quantity from
shop_product_flash
(stock
vssold
).- Reference helper:
gp247_product_flash_check_over($productId, $quantity)
.
- Reference helper:
- After the order is created: system increases
sold
value accordingly inshop_product_flash
.- Reference helper:
gp247_product_flash_update_stock($productId, $quantity)
.
- Reference helper:
Installation
See the official guide: Extension installation guide.
Quick steps:
- Plugin source is available at
app/GP247/Plugins/ProductFlashSale
. - In Admin panel:
- Go to Extensions/Plugins.
- Find "Product Flash Sale" and click Install.
- Click Enable to activate it.
- The system will:
- Add an admin menu under the Catalog group pointing to
admin_product_flash_sale.index
. - Create the data table
shop_product_flash
.
- Add an admin menu under the Catalog group pointing to
- Configure Flash Sale for products in admin:
- Choose a product (not Group type), set
stock
,sort
. - Set
price_promotion
,date_start
,date_end
, and turn onstatus_promotion
. - Save to create/sync the promotion info.
- Choose a product (not Group type), set
- Clear system cache (if enabled) to apply the latest config.
Front-end usage
- Flash Sale listing page: use route
product_flash_sale.index
in your theme.
Blade example to add a link:
{{-- Link to flash sale page --}}
Flash Sale
- Include the Flash Sale block on homepage or any position:
{{-- Include Product Flash Sale block --}}
@include('Plugins/ProductFlashSale::blocks.flash_sale')
-
Optional (override by template and manage via admin):
- Copy the block view from the plugin into your current template:
- Source:
app/GP247/Plugins/ProductFlashSale/Views/blocks/flash_sale.blade.php
- Destination:
app/GP247/Templates/{TEMPLATE}/blocks/flash_sale.blade.php
- Source:
- In admin, go to
layout_block
and add theflash_sale
block to your desired position.
- Copy the block view from the plugin into your current template:
-
Use helpers to build a custom list:
{{-- Get 8 flash sale products (no paginate) --}}
@php($products = gp247_product_flash(8))
@foreach($products as $product)
{{ $product->name }}
@endforeach
Notes:
- The sample block is at
app/GP247/Plugins/ProductFlashSale/Views/blocks/flash_sale.blade.php
. - Countdown uses
promotionPrice->date_end
andjquery.countdown
(CDN). - Display conditions: promotion enabled, current date within
date_start
→date_end
, andsold < stock
.
Enable/Disable and Uninstall
- Enable/Disable from the Admin Extensions/Plugins manager.
- Uninstall removes config, menu, home widget entry, and the
shop_product_flash
table created by this plugin.
Additional info
- Main source:
App\GP247\Plugins\ProductFlashSale\
. - Routes:
- Front:
GET /plugin/product_flash_sale/index
→ nameproduct_flash_sale.index
. - Admin:
GP247_ADMIN_PREFIX/product_flash_sale/*
with CRUD actions.
- Front:
- View/Translation namespace:
Plugins/ProductFlashSale
(e.g.Plugins/ProductFlashSale::blocks.flash_sale
,Plugins/ProductFlashSale::lang.*
).
Recommend products: