Problem with what looks like a hook problem with newly created module

Open to all! Ask other shopowners for help.
User avatar
burt
Core Team
Posts: 4551
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Problem with what looks like a hook problem with newly created module

Post by burt »

14Steve14 wrote: Sun Jun 22, 2025 10:51 am I now have a working hook that allows a page to show any products which are back in stock, so items from zero back to something, which should delete automatically after 14 days. Lets hope that bit works. Then may be worth trying to get any updated products with a stock increase to show. Something to play with later and if it works may be worth installing on my live site.
I like this idea. Make a copy of (eg) products_new.php and make the SQL (that finds what products to show) to do this;

show products

with stock > 0 [as newly updated products might sell quickly within the 14 day period]
AND
restock date within the last 14 days

For a shop that does NOT regularly add *new* products, but instead *restocks* products a lot, this page would be farrrrr more useful than products_new.php for customers.
I am not here to build for you.
I am here to build with you. Let's help each other.


Join The Code Co-op to get access to your library in the Code Co-op Forum
14Steve14
Senior Contributor
Posts: 923
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: Problem with what looks like a hook problem with newly created module

Post by 14Steve14 »

burt wrote: Tue Jun 24, 2025 8:52 am
14Steve14 wrote: Sun Jun 22, 2025 10:51 am I now have a working hook that allows a page to show any products which are back in stock, so items from zero back to something, which should delete automatically after 14 days. Lets hope that bit works. Then may be worth trying to get any updated products with a stock increase to show. Something to play with later and if it works may be worth installing on my live site.
I like this idea. Make a copy of (eg) products_new.php and make the SQL (that finds what products to show) to do this;

show products

with stock > 0 [as newly updated products might sell quickly within the 14 day period]
AND
restock date within the last 14 days

For a shop that does NOT regularly add *new* products, but instead *restocks* products a lot, this page would be farrrrr more useful than products_new.php for customers.
Hi Gary @burt .

I copied the featured products main page and language file and had AI make the changes for a back in stock column in the database. It was then a case of getting the hook right to do as you say. Any out of stock product with a quantity of zero, when updated shows in this new page. We can adjust the date range that products show for. Once a product hits the date for removal it just does not show on the page, but the date remains in the database column. It could be made to clear apparently but we have not looked into this yet.

We are also thinking of adjusting the hook so any stock that is increased on any product will show in the page as we have low stock o lots of products that we update before they totally run out.

The only other thing we did was to create a new module based on one of the other ones so a link shows in the navbar on the site pages, which was just an easy copy, adjust and update type of thing. So easy that even I could do it.

The whole point of this page was originally to replace a load of product listings in our weekly newsletter. We have found out that a single button is pressed more times that individual buttons to specific products, hence the need for a single page showing all restocked products.

I tried doing this using AI as more of a trial thing and it did eventually get most of it right, but there was a need for help here in this forum as the last little but it just could not get right. More part of me not knowing what was the right way to do something.

As the idea evolved there are thoughts of adding a module to show on the index pages, again similar to the featured products which show on different category pages, but that is only an idea at the moment and may make something simple quite hard and overly coplicated

I am sure that you could improve the idea 10 fold.
User avatar
burt
Core Team
Posts: 4551
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Problem with what looks like a hook problem with newly created module

Post by burt »

Using AI is the way forward. You are 100% correct in this though;
not knowing what was the right way to do something
The key to AI is to ask the correct questions.
Which is sometimes difficult if one doesn't really know.

The answer there is to tell AI what you want as the end result, then make it do incremental steps to that end result.
I am not here to build for you.
I am here to build with you. Let's help each other.
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Problem with what looks like a hook problem with newly created module

Post by ecartz »

This is the problem with the current level of AI. It doesn't understand how the code works, which then requires a senior developer to fix it. Meanwhile, only a junior developer is needed to write the code from scratch.

AI is advertised as making everyone a developer, but the reality is that it makes development more difficult by doing the easy parts badly.
frankl
Builder
Posts: 159
Joined: Tue Feb 23, 2021 8:39 pm
Phoenix Version: v1.1.0.4
Has thanked: 17 times
Been thanked: 26 times

Re: Problem with what looks like a hook problem with newly created module

Post by frankl »

If you have an openai account, go to https://chatgpt.com/gpts - top right click create button - click configure tab - fill in details, then upload Phoenix Cart zip file - in capabilities untick everything except Code Interpreter & Data Analysis - Save

Open the sidebar and your personalised ChatGPT will be in the list. Click on it and in the prompt tell it to study all the Phoenix Cart files.

Your GPT will more fully understand how Phoenix Cart works and the file structure when you ask it to review your code :)
azpro
Contributor
Posts: 177
Joined: Fri Nov 06, 2020 8:25 am
Phoenix Version: v1.1.0.6
Has thanked: 30 times
Been thanked: 34 times

Re: Problem with what looks like a hook problem with newly created module

Post by azpro »

How can I bookmark this post ... oh now it's in my forum activity list ;-)
14Steve14
Senior Contributor
Posts: 923
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: Problem with what looks like a hook problem with newly created module

Post by 14Steve14 »

Hi @frankl sorry for the delay in replying. I am only using the free version of chatGPT and don't think that is available to me.

We did manage to get this working in the end though. Would be interesting to see whether it would work on a later version as would make a nice addon.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply