Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Stock By Attributes help

Stock By Attributes help

Locked

Views: 666

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
10 Jul 2009, 10:59 PM
#1
safraz1 avatar

safraz1

New Zenner

Join Date:
Jul 2009
Posts:
41
Plugin Contributions:
0

Stock By Attributes help

hello all
im using the stock by atributes modual but theres a problem. it takes in to account of how much of the particular shoe i have in stock but not how much of the actuall size i have in stock. for example if i have 12 shoes but only 2 size 4s you can order 12 size 4s without it showing up as out of stock. any ways of fixing this.

thanks for your help

10 Jul 2009, 11:55 PM
#2
stevesh avatar

stevesh

Black Belt

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

Re: Stock By Attributes help

If I understand it, the Stock by Attributes mod is not a dependent attributes mod. If the original attribute is 'type of shoe', 'shoe size' would be a dependent attribute, and isn't supported.

11 Jul 2009, 12:22 AM
#3
kiddo avatar

kiddo

Totally Zenned

Join Date:
Jul 2006
Location:
SF Bay Area
Posts:
837
Plugin Contributions:
1

Re: Stock By Attributes help

I think he means that if there are 4 black shoes and 4 red shoes, you can still checkout with 6 red shoes in your cart.

Try this:

in includes/modules/pages/checkout_shipping/header_php.php

Find:

// Stock Check
  if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) {
    $products = $_SESSION['cart']->get_products();
    for ($i=0, $n=sizeof($products); $i<$n; $i++) {
      if (zen_check_stock($products[$i]['id'], $products[$i]['quantity'])) {
        zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
        break;
      }
    }
  }

and replace with:

// Stock Check
  if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) {
    $products = $_SESSION['cart']->get_products();
    for ($i=0, $n=sizeof($products); $i<$n; $i++) {

      // Added to allow individual stock of different attributes
      unset($attributes);
      if(is_array($products[$i]['attributes'])) {
	      $attributes = $products[$i]['attributes'];
      } else  {
	      $attributes = '';
      }
      // End change

      if (zen_check_stock($products[$i]['id'], $products[$i]['quantity'], $attributes)) {
        zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
        break;
      }
    }
  }

This may make it act like you expect.

Or maybe not.

11 Jul 2009, 12:39 AM
#4
safraz1 avatar

safraz1

New Zenner

Join Date:
Jul 2009
Posts:
41
Plugin Contributions:
0

Re: Stock By Attributes help

thanks i just got so fustrated and reinstalled the stock by atributes mod like ten times but yay it did the trick lol. its such a good feature and it finally works.
well thanks for your time and help. much love

11 Jul 2009, 12:40 AM
#5
kiddo avatar

kiddo

Totally Zenned

Join Date:
Jul 2006
Location:
SF Bay Area
Posts:
837
Plugin Contributions:
1

Re: Stock By Attributes help

Coolies! Glad that work for you.

Good luck with your shop.