Forums / Setting Up Categories, Products, Attributes / Hiding Attributes when out of stock in that size

Hiding Attributes when out of stock in that size

Locked

Started by afterglow on 20 May 2008, 5:38 PM · Views: 9,899

Results 1 to 20 of 21
This thread is locked. New replies are disabled.
20 May 2008, 5:38 PM
#1
afterglow avatar

afterglow

New Zenner

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

Hiding Attributes when out of stock in that size

Hi all,
I did a search but came up empty. I'm trying to see if this is possible.. basically under "Attributes Controller", I was wondering if it's possible to add an option under attribute flags&legend "hide/unhide".

Here's what I'm trying to do.. basically we sell sandals in our store and we set up each color to have size attributes small to extra large etc. we're a small business so we tend to run out of stock in certain sizes, so I end up having to go into attributes controller and manually remove the attribute when out of stock in that size, and then reinsert it at a later time when we have that size back in stock.

Example:
Black -=Small
-=Medium
-=Large (if out of stock in large, can this option be hidden to customer temporarily, like when hiding products under categories/products "status-enable/disable"?)
-=X-Large

thanks for any help!

20 May 2008, 5:55 PM
#2
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Hiding Attributes when out of stock in that size

There's 'Stock by Attribute' mod here http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=310

I haven't used it, but I think it would show '0' units in stock when you were out.

You might be able to build on it to hide the sizes.

6 Jun 2008, 2:22 PM
#3
audiorange avatar

audiorange

New Zenner

Join Date:
May 2008
Posts:
4
Plugin Contributions:
0

Re: Hiding Attributes when out of stock in that size

Did you discover anything on this afterglow? I have the same issue with a store I am building for a footwear company with often low stock levels in certain sizes. I have installed stock by attributes, which is excellent - however, as you point out, it does not remove attribute value from my size drop-down when that particular size runs out of stock...

13 Jul 2008, 6:56 PM
#4
oshuaj0 avatar

oshuaj0

New Zenner

Join Date:
Jul 2008
Posts:
2
Plugin Contributions:
0

Re: Hiding Attributes when out of stock in that size

Hi there,
I am having the same problem. Has anyone gotten this to work yet? Thanks!

10 Aug 2008, 11:32 PM
#5
hpsales avatar

hpsales

New Zenner

Join Date:
Aug 2008
Posts:
3
Plugin Contributions:
0

Re: Hiding Attributes when out of stock in that size

What I do for a product that has multipule attributs that sell out and later get restocked is to minipulate in the products_attribute table the field 'attributs_display_only'. The attribute still is visable but is not selectible if set to '1'. When it gets restocked, simply reset the control bit to a '0'.

This can be done with a simple SQL script UPDATE command or of course you can set/reset the raw database. Since I have over 9000 items, half of which have attributs of which hundreds change daily, my inventory program writes the script for updating everything so I don't have a sample script. But that's a way to do it without deleting the attribute.

14 Aug 2008, 7:33 AM
#6
jenn8five avatar

jenn8five

New Zenner

Join Date:
Aug 2008
Posts:
54
Plugin Contributions:
0

Re: Hiding Attributes when out of stock in that size

stevesh:

There's 'Stock by Attribute' mod here http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=310

I haven't used it, but I think it would show '0' units in stock when you were out.

You might be able to build on it to hide the sizes.

i'd like to use this contribution, but do not know how to complete the first step --

Create a new database table and a new configuration switch by running the 'stock_attribute.sql' via Admin->Tools->Install SQL Patches.

does anyone have the query so that i can plug it into "install SQL patches?"

thanks

14 Aug 2008, 7:35 AM
#7
jenn8five avatar

jenn8five

New Zenner

Join Date:
Aug 2008
Posts:
54
Plugin Contributions:
0

Re: Hiding Attributes when out of stock in that size

oops.. never mind. sorry. i found it in the download. :oops:

14 Aug 2008, 8:06 AM
#8
jenn8five avatar

jenn8five

New Zenner

Join Date:
Aug 2008
Posts:
54
Plugin Contributions:
0

Re: Hiding Attributes when out of stock in that size

ok, so i was able to install the contribution w/o issue.
i entered in all the quantities for the product variants --> selected sync quantities. quantity for all variants = 23

on config --> stock:

check stock level = true
subtract stock = true
allow checkout = false
show avail stock level in cart when less than order = true

admin --> categories/product admin = quantity for the product = 23

so why is it that it still allows the customer to check-out if they order more than the attribute quantity? for example, i have it set to 10 blue pants, 8 red pants, 5 green pants so it's 23 total. if the user selects 10 green pants, it allows him/her to check out. it's working properly if i select 40 green pants -- the transaction is rejected.

pls let me know what i'm missing!

14 Aug 2008, 8:08 AM
#9
jenn8five avatar

jenn8five

New Zenner

Join Date:
Aug 2008
Posts:
54
Plugin Contributions:
0

Re: Hiding Attributes when out of stock in that size

also, if i have the option name set as checkboxes, the user can select +1 color... which is great. however, the cart doesn't get updated with the additional quantity items. so in essence, the user can select 4 different colors, but still check out with only 1 item. this will be a pain cuz then i'll have to contact them to get it straightened out. are there any contributions for this or does it already exist on the system?

14 Aug 2008, 8:47 AM
#10
jenn8five avatar

jenn8five

New Zenner

Join Date:
Aug 2008
Posts:
54
Plugin Contributions:
0

Re: Hiding Attributes when out of stock in that size

i reinstalled the contribution and that seemed to do the trick. it must have been because during the first installation, one of the files didn't get overwritten bc i didn't make a selection in time. i ended up overwriting all the duplicate files and it's working now. i hope i didn't "break" something else. :ohmy:

11 Sep 2008, 11:11 AM
#11
dudeshouse avatar

dudeshouse

New Zenner

Join Date:
Dec 2005
Location:
Portishead, UK
Posts:
32
Plugin Contributions:
0

Re: Hiding Attributes when out of stock in that size

Has anyone come up with a simple solution to this problem?

I don't really want to install this contribution as it's overkill for what I'm after. If there is an easy way of using the "Display Only" option to not display the Attribute on an item, I feel that this would be the simplest. Has anyone done this as I'm not sure where to start.

Any help would be greatly appreciated.

Cheers.

...there is nothing worse than aggresive stupidity...

26 Sep 2008, 6:54 PM
#12
afterglow avatar

afterglow

New Zenner

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

Re: Hiding Attributes when out of stock in that size

I've tried the stock by attribute mod, but it doesn't work for what I need... it doesn't disable the attribute at all when that stock level hits 0. seems to only like positive numbers.. the mod keeps levels at 1 in the store even though it says 0 in the admin section...

has this been figured out yet? can we add a disable attribute function under attributes controller? so that it disables(hides/unhides) that one attribute for that specific product? please, any help would be most appreciative...

26 Sep 2008, 7:03 PM
#13
afterglow avatar

afterglow

New Zenner

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

Re: Hiding Attributes when out of stock in that size

my mistake, fortunately it does say it's out once in the shopping cart... can we show this before they click add to cart?

1 Nov 2008, 11:36 AM
#14
merchnation avatar

merchnation

New Zenner

Join Date:
Mar 2008
Posts:
17
Plugin Contributions:
0

Re: Hiding Attributes when out of stock in that size

This mod would be perfect if the attribute = 0 it is not displayed. it makes me look stupid if I do not go in there and disable it before someone else gets in there and tries to buy it :(

29 Dec 2008, 9:34 PM
#15
bc3030 avatar

bc3030

New Zenner

Join Date:
Apr 2008
Posts:
5
Plugin Contributions:
0

Re: Hiding Attributes when out of stock in that size

hpsales:

What I do for a product that has multipule attributs that sell out and later get restocked is to minipulate in the products_attribute table the field 'attributs_display_only'. The attribute still is visable but is not selectible if set to '1'. When it gets restocked, simply reset the control bit to a '0'.

This can be done with a simple SQL script UPDATE command or of course you can set/reset the raw database. Since I have over 9000 items, half of which have attributs of which hundreds change daily, my inventory program writes the script for updating everything so I don't have a sample script. But that's a way to do it without deleting the attribute.

I had this issue today and I found the above advice posted by hpsales to be the easiest thing to do.

Here is the SQL update statement I used:

Update products_attributes SET attributes_display_only = 1 WHERE products_attributes_id = XXXX ;

You just need to figure out the products_attributes_id for the attributes you want to temporarily deactivate. (There's probably an easier way to do it, but I just went into the attributes controller and put my mouse pointer over the "edit" button for the attribute I wanted to deactivate and it showed the attribute in the Firefox status bar).

7 Mar 2009, 8:04 PM
#16
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: Hiding Attributes when out of stock in that size

There doesn't appear to be a solution to this then. The only thing you've come up with above is to manually disable or manually deactivate an attribute when it's out of stock.

There has to be a way of modifying the code in the php files so that attributes with stock level=0 are automatically hidden or deleted?

It's a mammoth task to manually disable/delete attributes every time a particular size for a particular item goes out of stock.

Has anyone figured out which part of the code could be manipulated to achieve automation?

15 Mar 2009, 11:40 PM
#17
surrealdesign avatar

surrealdesign

New Zenner

Join Date:
Jan 2009
Posts:
6
Plugin Contributions:
0

Re: Hiding Attributes when out of stock in that size

I too have been googling/searching for solutions.

I would be happy if the attribute remained viewable, but had an (out of stock) thing beside it or something...

and the items that are still in stock could have numbers beside them stating how many there are aswell....

I see it on so many shops, woulda thought it would be quite easy... only just started dealing with attributes though...

TIA.
Nyssa

30 Mar 2009, 12:31 PM
#18
dsided avatar

dsided

Zen Follower

Join Date:
Jun 2008
Posts:
128
Plugin Contributions:
0

Re: Hiding Attributes when out of stock in that size

Any comment from the developers? Will this appear in the next version of zen cart?

John Crumpton, Technical Director of Double Sided
Zen cart shop: Buy happie loves it

3 Jul 2009, 4:23 AM
#19
erko avatar

erko

New Zenner

Join Date:
Jun 2009
Location:
Australia
Posts:
20
Plugin Contributions:
0

Re: Hiding Attributes when out of stock in that size

Hi all,

I've been searching for a solution for this as well, and have come across this thread. I have installed Stock by Attributes.

I haven't been able to come up with a solution, but my observations below may hopefully trigger something with another zen carter.

In the CUSTOM\modules\attributes.php there is this piece of code;

<div class="wrapperAttribsOptions">

<h4 class="optionName back"><?php echo $options_name[$i]; ?></h4> <div class="back"><?php echo "\n" . $options_menu[$i]; ?></div> <!-- <br class="clearBoth" />--> </div>

This is where the HTML drop down box gets written, and it is the $options_name variable which consist of the attributes items that are found in the drop down box.

Given my VERY limited programming knowledge - I would think that when the php code loops through the $options_name variable to parse the HTML, a simple "If stock = 0, then skip attribute" is required.

From what I see the CUSTOM\modules\tpl_modules_attributes.php is the file that holds all of the processing of the attributes.

That's me thinking out aloud, will attempt to dissect the code to try and figure this one out. :frusty:

Any ideas? or pointers to add?

erko

7 Jul 2009, 12:47 PM
#20
erko avatar

erko

New Zenner

Join Date:
Jun 2009
Location:
Australia
Posts:
20
Plugin Contributions:
0

Re: Hiding Attributes when out of stock in that size

Just an update...

I've pinpointed exactly where the loop of the drop down box is written.. was looking in the wrong place..

It's in ..

\includes\functions\html_output.php

Code being (around line 504);

for ($i=0, $n=sizeof($values); $i<$n; $i++) {

  $field .= '  <option value="' . zen_output_string($values[$i]['id']) . zen_output_string($values[$i]['qty']) . '"';
  
  if ($default == $values[$i]['id']) {
    $field .= ' selected="selected"';
  }

  $field .= '>' . zen_output_string($values[$i]['text'], array('"' => '"', '\'' => ''', '<' => '<', '>' => '>')) . '</option>' . "\n";
}
$field .= '</select>' . "\n";

Now, I just need to add the if statement around it. The syntax will be;

for ($i=0, $n=sizeof($values); $i<$n; $i++) {

if zen_output_string($values[$i]['QTY'] >= 1 {
$field .= ' <option value="' . zen_output_string($values[$i]['id']) . zen_output_string($values[$i]['qty']) . '"';
}

  if ($default == $values[$i]['id']) {
    $field .= ' selected="selected"';
  }

  $field .= '>' . zen_output_string($values[$i]['text'], array('"' => '"', '\'' => ''', '<' => '<', '>' => '>')) . '</option>' . "\n";
}
$field .= '</select>' . "\n";

but I need to know how to call the stock qty variable for the particular attribute. The code zen_output_string($values[$i]['QTY'] is a placeholder and is NOT correct.

anyone can help here??

erko