Page 1 of 1

Bulk Specials

Posted: Fri Aug 15, 2025 11:56 am
by burt
How about a new system that allows the Admin user to bulk add/edit specials, and also delete specials.

Concept

1. 3 new Buttons in the specials.php page

Easy, no core code changes in recent versions of Phoenix.
spec_buttons.png

Each of these Buttons does something "special", from left to right;

1a/ Red button will delete all specials that are INACTIVE.
Self Explanatory, right?

1b/ Blue Export button will popup a modal that allows admin user to select what fields should be included in the Download and what format (whichever admin user is more comfortable with, I personally prefer and use JSON, but CSV is also included);
spec_download.png
On clicking the "Download" button, the JSON or CSV file is downloaded, including all the info requested. EG JSON:

Code: Select all

[
    {
        "specials_id": 7,
        "products_id": 1,
        "price": 2.99,
        "status": 1
    },
    {
        "specials_id": 8,
        "products_id": 8,
        "price": 3.5,
        "status": 0
    },
    {
        "specials_id": 9,
        "products_id": 7,
        "price": 1.25,
        "expires": "2025-08-31 23:59:59",
        "status": 1
    }
]
Or EG CSV

Code: Select all

specials_id,products_id,price,expires_date,status
7,1,2.9900,1
8,8,3.5000,0
9,7,1.2500,"2025-08-31 23:59:59",1
At this point, the Admin User can change any of the details. EG: change product ID 7 from $1.25 to $3.00 (or whatever). The Admin User can also add NEW specials in here, for example an extra JSON block as so;

Code: Select all

{
  "products_id": 3,
  "price": 2.00,
  "status": 1
}
This block says put Product ID 3 onto active special at $2.00 special price. NOTE there is no "expiration" as this is an open ended offer, and no Special ID as this is a NEW special.

1c/ Blue Import button will popup a modal that allows admin user to select a file. This could be the File you previously downloaded and amended, or it could be a new file you created from scratch.

spec_upload.png

Clicking will result in the usual file explorer, allowing you to select a CSV or JSON file.

Click Upload will result in an error or success message in the Modal. If Fail, a message will be shown allowing you to fix your file and try again. If success, the page will reload and your Specials will be updated appropriately, notice in the image, the new special at a cost of $2 and the updated special at a cost of $3 (as per my JSON file).

Conclusion

spec_updated.png

Faster and easier updates of Specials.

Re: Bulk Specials

Posted: Fri Aug 15, 2025 12:18 pm
by burt
This is all coded and working, but only as what I call "proof of concept" code - in other words, quite ugly, hardcoded to one language and so on. If there is interest, I'll update the code, put it out for some testing and then if testing come back OK, put it into the August Code Drops.

But I don't want to spend more time if there is little interest!

Re: Bulk Specials

Posted: Fri Aug 15, 2025 1:40 pm
by azpro
For shopowners with lot's of products I can't imagine there would be little interest - But I understand if you need more commitment :+1:

Re: Bulk Specials

Posted: Sat Aug 16, 2025 7:01 am
by radhavallabh
Cool concept dear but would prefer this type for products upload.. that is an area that requires more of such inclusions I think...
Thank you in advance;
Warm Regds./
radhavallabh

Re: Bulk Specials

Posted: Sat Aug 16, 2025 7:22 am
by raiwa
radhavallabh wrote: Sat Aug 16, 2025 7:01 am Cool concept dear but would prefer this type for products upload.. that is an area that requires more of such inclusions I think...
Thank you in advance;
Warm Regds./
radhavallabh
It exists already:
https://phoenixcart.org/forum/app.php/ ... _phoenix_3

Re: Bulk Specials

Posted: Sat Aug 16, 2025 11:21 am
by burt
It was done on this page as proof of concept as it's a simple page that updates a simple database table.

Products is far more complicated as need to factor in a number of things; languages and attributes and downloads and images and more. I can't imagine taking the time/effort to make that - the ROI of my time/effort would be zero.

Re: Bulk Specials

Posted: Sat Aug 16, 2025 1:26 pm
by Dan Cole
burt wrote: Fri Aug 15, 2025 12:18 pm This is all coded and working, but only as what I call "proof of concept" code - in other words, quite ugly, hardcoded to one language and so on. If there is interest, I'll update the code, put it out for some testing and then if testing come back OK, put it into the August Code Drops.

But I don't want to spend more time if there is little interest!
I like this idea Gary and I think it would be helpful. As a suggestion it might be nice to have the ability (if it doesn't already) to select by say manufacturer and perhaps category to slim up the download a bit and hence items to look through.

Dan

Re: Bulk Specials

Posted: Sat Aug 16, 2025 2:40 pm
by burt
spec_with_brand.png

Now with Brand/Manufacturer selector.

Re: Bulk Specials

Posted: Sun Aug 17, 2025 10:28 am
by 14Steve14
May seem a silly question but in your example Gary you mention product with an ID of 7. How does the store owner know what that product is? Could the product name be included?

Re: Bulk Specials

Posted: Sun Aug 17, 2025 10:32 pm
by burt
Adding the Product Name is easy enough;

with_name.png

Obviously the name could not be updated using this script, as this updates specials for Price, Expiration, Status.