Forums / Setting Up Categories, Products, Attributes / Change sold out image for upcoming products only?

Change sold out image for upcoming products only?

Locked

Views: 4,025

Results 1 to 20 of 20
This thread is locked. New replies are disabled.
1 Feb 2009, 2:03 PM
#1
jenzi avatar

jenzi

Zen Follower

Join Date:
Jan 2007
Posts:
145
Plugin Contributions:
0

Change sold out image for upcoming products only?

Hi there,

Can someone please tell me how I can change the sold out image that displays for upcoming/new products with 0 quantity yet in stock, without the image affecting legit out of stock items?

(Iwant to keep the "sold out" image for existing stock that is actually sold out...)

So, I'd like to create an image that says "coming soon" for the upcoming stuff, and leave "sold out" for existing stuff that is out of stock...

Hopefully that makes sense?

1 Feb 2009, 5:14 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Change sold out image for upcoming products only?

As they both have a "0" stock quantity - How will you differentiate those that are out and those that are coming???

Zen-Venom Get Bitten

1 Feb 2009, 8:02 PM
#3
jenzi avatar

jenzi

Zen Follower

Join Date:
Jan 2007
Posts:
145
Plugin Contributions:
0

Re: Change sold out image for upcoming products only?

Well, I'll know, but I suppose you mean to ask how the system will be able to tell? Good question, then. :)

Sounds like it can't be done without some scary coding?

Is there another way around this?

8 Mar 2009, 6:39 PM
#4
dinnages avatar

dinnages

Zen Follower

Join Date:
May 2007
Location:
Brighton/Hove/Sussex
Posts:
146
Plugin Contributions:
0

Re: Change sold out image for upcoming products only?

The system must know at least some difference with it having a date on forthcoming so if we put 1 (one) in the stock, but as its not yet to hand does it cover the problem if there is a coding patch to ensure the single one in stock cannot be bought until that due date?
Not actually tried that to be honest, just was looking for the same query, & was my next step, but I would prefer a 'coming soon' logo, plus a page visitors can look at like a duplicate listing we could have them all listed at, but would disapear once the date comes round.
Does my thoughts on this make sense?

Original store was 1.39:- TransportPostcards.co.uk/shop (redirecting out)
Working on a fresh new store... 1.56a TransportPostcards.co.uk/store
Appreciate Zen-Cart? - Always keep a banner link on your shop

8 Mar 2009, 7:20 PM
#5
dinnages avatar

dinnages

Zen Follower

Join Date:
May 2007
Location:
Brighton/Hove/Sussex
Posts:
146
Plugin Contributions:
0

Re: Change sold out image for upcoming products only?

Nope, just tried and gives an 'add to basket' sign so misses the point of 'not yet available' must be a work round somehow.

Even giving a zero costing you can still buy it once you put any stock in it just to avoid a big red 'sold out' sign on something thats not even available yet. Does make a store look odd to the customer.

Original store was 1.39:- TransportPostcards.co.uk/shop (redirecting out)
Working on a fresh new store... 1.56a TransportPostcards.co.uk/store
Appreciate Zen-Cart? - Always keep a banner link on your shop

8 Mar 2009, 9:36 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Change sold out image for upcoming products only?

You could change the functions_general.php and around line 1339 you will see:

    switch (true) {
// cannot be added to the cart
    case (zen_get_products_allow_add_to_cart($product_id) == 'N'):
      return $additional_link;
      break;

change to read:

    switch (true) {
// cannot be added to the cart
    case (zen_get_products_allow_add_to_cart($product_id) == 'N'):
      return $additional_link;
      break;
// not available for purchase based on products_date_available      
case ($button_check->fields['products_date_available'] > date('Y-m-d H:i:s')):
      return 'NOT AVAILABLE YET';
break;

You will need to tweak this a bit here and there but this will stop the Add to Cart on products that are Upcoming Products ... everywhere in the shop ...

Nifty the power of the functions in Zen Cart, eh? :cool:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

9 Mar 2009, 7:38 AM
#7
dinnages avatar

dinnages

Zen Follower

Join Date:
May 2007
Location:
Brighton/Hove/Sussex
Posts:
146
Plugin Contributions:
0

Re: Change sold out image for upcoming products only?

Ajeh:

You could change the functions_general.php and around line 1339 ...
Nifty the power of the functions in Zen Cart, eh? :cool:
Great work there, as the previous poster said, down to some nifty code, & over my head to write that sort of thing.
Will give that a go. Many thanks.

Doing this, I presume is covered in the custom overides system.
Looking forward, many of these little adaptions could be not compatable with version 2.0 ?
1.3.7 is working fine just not the PayPal express bit, so satying put for now.

Original store was 1.39:- TransportPostcards.co.uk/shop (redirecting out)
Working on a fresh new store... 1.56a TransportPostcards.co.uk/store
Appreciate Zen-Cart? - Always keep a banner link on your shop

9 Mar 2009, 4:25 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Change sold out image for upcoming products only?

This is not an override for the function file ... be sure to backup your original as well as the customized one ...

The advantage of customizing this function is that it affects all of the Add to Cart and Buy Now features ...

To use the Overrides, you would have to touch a lot of files to make the same change ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

9 Mar 2009, 5:45 PM
#9
dinnages avatar

dinnages

Zen Follower

Join Date:
May 2007
Location:
Brighton/Hove/Sussex
Posts:
146
Plugin Contributions:
0

Re: Change sold out image for upcoming products only?

Ah now thats worth keeping in mind, anything I have done has been trying to grasp this override system until this suggested bit of code.
I have renamed any original file & replaced it with the new version just in case, as one slip of a character has killed the whole site from working misunderstanding the flow of php on one error.
Without diverting the topic too far, will all our overides & tinkering like this therefore be absolutly dead? Im not 100% confident about making any upgrade, fear of losing all my templates & layouts.

Will post back for others benefit how the code here works.
Many thanks

Original store was 1.39:- TransportPostcards.co.uk/shop (redirecting out)
Working on a fresh new store... 1.56a TransportPostcards.co.uk/store
Appreciate Zen-Cart? - Always keep a banner link on your shop

9 Mar 2009, 6:37 PM
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Change sold out image for upcoming products only?

The templates and override files are in your custom directories and should not get touched by an upgrade ... although you may need to update them ...

NOTE: Always upgrade a test site with a test database before attempting a Live Site ...

As to customizing code that cannot be overridden, saving your changed file(s) and the original file(s) allows you to compare them and add your changes back in when upgrading ...

Backups are the secret to success ... :cool:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

29 Nov 2009, 11:34 PM
#11
rgme avatar

rgme

New Zenner

Join Date:
Oct 2009
Posts:
33
Plugin Contributions:
0

Re: Change sold out image for upcoming products only?

Ajeh:

switch (true) {

// cannot be added to the cart
case (zen_get_products_allow_add_to_cart($product_id) == 'N'):
return $additional_link;
break;

> 
> change to read:
> ```
    switch (true) {
// cannot be added to the cart
    case (zen_get_products_allow_add_to_cart($product_id) == 'N'):
      return $additional_link;
      break;
// not available for purchase based on products_date_available      
case ($button_check->fields['products_date_available'] > date('Y-m-d H:i:s')):
      return 'NOT AVAILABLE YET';
break;

I tried that, but clicking the Add to Cart button when viewing the singular product still adds the item not available to the cart. Maybe because the product shows some stock? I think the supplier uses the stock level to indicate how many will be available on the availability date, instead of showing zero in stock.

I tried changing one line of that code to read
case ($button_check->fields['products_date_available'] ): and
case ($button_check->fields['products_date_available'] > ' '):
in hope this was just a string comparison, but I still can add it to the cart, which makes me think the line isn't being executed if there is a quantity of stock > zero. Did I guess right? Anything I can do so the code will work even if the product shows stock?

29 Nov 2009, 11:49 PM
#12
rgme avatar

rgme

New Zenner

Join Date:
Oct 2009
Posts:
33
Plugin Contributions:
0

Re: Change sold out image for upcoming products only?

Forgot to add link to my previous msg and more than 7 minutes went by...

http://www.RGMEusa1.com/eStore2
Click on left column Category "BBQ", scroll to bottom of page, click on the item that won't be available until 12/08/2009 (that's m/d/Y format there, but what was given to Easy Populate was 08/12/09 = d/m/y format).

30 Nov 2009, 4:12 PM
#13
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Change sold out image for upcoming products only?

First, fix your site for Known Bug Fixes:
http://www.zen-cart.com/forum/showthread.php?t=82619

specifically it looks like your Upcoming product is marked as Out of Stock and is still showing in the Upcoming Product Center Box ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

30 Nov 2009, 7:15 PM
#14
rgme avatar

rgme

New Zenner

Join Date:
Oct 2009
Posts:
33
Plugin Contributions:
0

Re: Change sold out image for upcoming products only?

Ajeh:

First, fix your site for Known Bug Fixes:
http://www.zen-cart.com/forum/showthread.php?t=82619

specifically it looks like your Upcoming product is marked as Out of Stock and is still showing in the Upcoming Product Center Box ...

Thank you very much for the reply, it pointed me in the direction I needed! The upcoming products listing is now working as I want it to. My supplier for that store uses the same "in stock" quantity field, in their tab delimited Excel file, for showing how many will be in stock on a certain day, as they do with products that are currently in stock.

I wrote a program that takes that Excel file and manipulates the data of each product, and then uses the results to create a file for Easy Populate v1.2.5.4 (EP) to use to import (and manage) inventory to the store. When I decided to show ALL prices as a "special" in the store, which is a markdown from the manufactures suggested list price, I failed to set the EP field named v_status to "0" when the supplier was showing an inventory that was currently in stock (in the EP v_products_quantity field) but which would not actually be available until the date shown in the EP v_date_avail field.

I used EP to get a complete list of all store products so I could look at it in Excel. Only 4 products had an EP v_products_quantity field of greater than "0" along with an EP v_date_avail field showing a future date and a v_status field having a value of "1". In those 4 cases, that represented what the stock would be but only on and after the date shown in the EP v_date_avail field. But my program had set the EP v_status field to "1" instead of to "0" in those 4 cases. This particular combination of EP field settings will cause ZC to list the products as to be available at a later date (as I want it to do) but also allow a user to click a link in that same list and see the product and add it to the cart! Setting v_status to "0" in those cases altered that behavior so that ZC would report that product as being not found if the link is clicked in the future availability list and so the product cannot be added to the cart, which is exactly what I want and how the store behaves now. Because only 4 products were acting wrongly when clicked in the future availability listing, I was just lucky to have noticed the issue by clicking on a link!

Bottom line is: If a product has an EP v_date_avail field that is not empty and it points at a future date, then make sure the EP v_status field has a value of "0". Then the EP v_products_quantity field content will be ignored by ZC as if there was no stock even though that field shows there is stock (which will be available on the date shown in the EP v_date_avail field). I've no idea if ZC will or will not effectively set things as visible to the user to place into the cart (the same as setting the EP v_status field to "1") once the date shown in the EP v_date_avail field arrives but only if the EP v_products_quantity shows a value above zero (I'm betting it doesn't, but I think it should).

30 Nov 2009, 7:30 PM
#15
rgme avatar

rgme

New Zenner

Join Date:
Oct 2009
Posts:
33
Plugin Contributions:
0

Re: Change sold out image for upcoming products only?

Oh shoot, I didn't mean to post that last post of mine in THIS thread I'd subscribed to. It belonged in another thread. Sorry.:blush:

8 Oct 2010, 1:49 PM
#16
softcorpse avatar

softcorpse

Zen Follower

Join Date:
Aug 2004
Posts:
96
Plugin Contributions:
0

Re: Change sold out image for upcoming products only?

Ajeh:

You could change the functions_general.php and around line 1339 you will see:

switch (true) {

// cannot be added to the cart
case (zen_get_products_allow_add_to_cart($product_id) == 'N'):
return $additional_link;
break;

> 
> change to read:
> ```
    switch (true) {
// cannot be added to the cart
    case (zen_get_products_allow_add_to_cart($product_id) == 'N'):
      return $additional_link;
      break;
// not available for purchase based on products_date_available      
case ($button_check->fields['products_date_available'] > date('Y-m-d H:i:s')):
      return 'NOT AVAILABLE YET';
break;

Thanks this works pretty well, however I was hoping it would be possible to edit this code a little to keep the "add to cart" button, but also just below the button to include the countdown to when it would be actually in stock. This would allow people to "pre-order" an item but they would know that the stock would only arrive on the date set.

Thanks for any help provided Ajeh ;)

8 Oct 2010, 2:52 PM
#17
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Change sold out image for upcoming products only?

You can always change what is sent back to include the date ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

8 Oct 2010, 4:03 PM
#18
softcorpse avatar

softcorpse

Zen Follower

Join Date:
Aug 2004
Posts:
96
Plugin Contributions:
0

Re: Change sold out image for upcoming products only?

Thanks, however I'm not a coder myself, I tried playing around with the code to get my intended result, however was not able to get it working. Was hoping you could me with that please :)

8 Oct 2010, 4:08 PM
#19
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Change sold out image for upcoming products only?

You can try adding:
$button_check->fields['products_date_available']

or use:
zen_date_short(($button_check->fields['products_date_available'])

and add that to the text ...
'NOT AVAILABLE YET'

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

8 Oct 2010, 6:51 PM
#20
softcorpse avatar

softcorpse

Zen Follower

Join Date:
Aug 2004
Posts:
96
Plugin Contributions:
0

Re: Change sold out image for upcoming products only?

Sorry Ajeh, I quoted you on the wrong thread, please see:

http://www.zen-cart.com/forum/showthread.php?p=944435

You can delete my posts on this thread, it was the wrong code I was refering to...