Zen Cart Logo
Forums / All Other Contributions/Addons / Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Views: 658,711

Results 1,121 to 1,140 of 3,609
22 Mar 2011, 2:41 AM
#1121
buildingblocks avatar

buildingblocks

Totally Zenned

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

Stock by Attribute v4.0 addon for v1.3.5-1.3.9

If someone selects an item that is out of stock and clicks the add to cart button, is it possible to keep the buyer on the product page with an alert showing their selection is out of stock instead of having to go to the shopping cart page and then back to the product page to revise their selection?

22 Mar 2011, 2:47 AM
#1122
swamyg1 avatar

swamyg1

Zen Follower

Join Date:
Dec 2008
Location:
San Fran
Posts:
382
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

buildingblocks:

If someone selects an item that is out of stock and clicks the add to cart button, is it possible to keep the buyer on the product page with an alert showing their selection is out of stock instead of having to go to the shopping cart page and then back to the product page to revise their selection?

This would be awesome! I would love to show customers available stock on the product page itself. If anyone is able to code this please pm me, most definitely willing to pay!

22 Mar 2011, 12:16 PM
#1123
tre4 avatar

tre4

New Zenner

Join Date:
Mar 2011
Posts:
3
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

swamyg1:

This would be awesome! I would love to show customers available stock on the product page itself. If anyone is able to code this please pm me, most definitely willing to pay!

Amen to that - am ploughing through 100's of threads to look for the answer. No joy yet....

27 Mar 2011, 7:12 PM
#1124
fvb avatar

fvb

Zen Follower

Join Date:
Dec 2006
Posts:
102
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

we are using zen cart v1.3.9ep1

in admin/Catalog
on the Products with Attributes Stock page, when we click save we get this error

A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete.

Script: http://www.foxvalleybirkenstock.com/ajax/jquery.js:11

we get this using IE adn firefox

Oddly enough this mod seems to work without error in the safari web browser
But it is extremely slow

I think part of the problem is the number of items it is showing the page
One site has 6859 items and the other has 2276 items
The one with 2276 is noticeably faster, but still a little slow
Would there be a way to limit the items displayed, “say by clearance items”

31 Mar 2011, 1:46 PM
#1125
athena avatar

athena

Totally Zenned

Join Date:
Jan 2006
Location:
NM
Posts:
740
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

your're not alone...having same issue

wyocraft:

Ok, So I have installed the Stock by attribute on my site 2 times now and had to remove it 2 times. What the Heck!!!

So here is whats going on.

I have zen 139h, a simple template I bought from Template Warehouse a canned one that is sold all over, nothing special, I changed up the background and a few other things but nothing special.

So here is my problem

Lets say I have 2 products, 1 with attribute small, medium and large, and another product that has no attribute. the product without the attribute has 3 instock and the one with attribute has 2 of each size instock. I think I have it all setup correctly but here is what happens. I add the product WITHOUT the attribute to the cart and update it to 4, it never flashes red *** and lets me check out and the 4th item is backorded. Now if I add a small item from the one with the attribute then add 4 of the product without the atribute it shows the out of stock warning. I delete the one with the attribute and the warning goes away on the one without.

So do I have to assign attributes to every item even if there is only one type or is there a fix to this. I have spend about 10 hours trying to get a clear answer to fix my problem.

Thanks

31 Mar 2011, 1:51 PM
#1126
athena avatar

athena

Totally Zenned

Join Date:
Jan 2006
Location:
NM
Posts:
740
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Thieving_Gypsy:

well - would you believe it - the PWAS 4.7 Ajax package doesn't include the classes directory or the orders.php class file... so I'll find that from an older version and just hope it works....

Please list the missing files in their directories...having similar issue...

31 Mar 2011, 2:24 PM
#1127
athena avatar

athena

Totally Zenned

Join Date:
Jan 2006
Location:
NM
Posts:
740
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Chris...this just threw me a blank page at check out :( did it really solve the issue for you?

ChrisD24:

Holy cow I think I figured it out. Please tell me this works for you!

<?php /** * shopping_cart header_php.php * * @package page * @copyright Copyright 2003-2010 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: header_php.php 17948 2010-10-13 20:33:18Z drbyte $ */ // This should be first line of the script: $zco_notifier->notify('NOTIFY_HEADER_START_SHOPPING_CART'); require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php')); $breadcrumb->add(NAVBAR_TITLE); // Validate Cart for checkout $_SESSION['valid_to_checkout'] = true; $_SESSION['cart_errors'] = ''; $_SESSION['cart']->get_products(true); if (!$_SESSION['valid_to_checkout']) { $messageStack->add('shopping_cart', ERROR_CART_UPDATE . $_SESSION['cart_errors'] , 'caution'); } // build shipping with Tare included $shipping_weight = $_SESSION['cart']->show_weight(); /* $shipping_weight = 0; require(DIR_WS_CLASSES . 'order.php'); $order = new order; require_once('includes/classes/http_client.php'); // shipping in basket $total_weight = $_SESSION['cart']->show_weight(); $total_count = $_SESSION['cart']->count_contents(); require(DIR_WS_CLASSES . 'shipping.php'); $shipping_modules = new shipping; $quotes = $shipping_modules->quote(); */ $totalsDisplay = ''; switch (true) { case (SHOW_TOTALS_IN_CART == '1'): $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . TEXT_TOTAL_WEIGHT . $shipping_weight . TEXT_PRODUCT_WEIGHT_UNIT . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total()); break; case (SHOW_TOTALS_IN_CART == '2'): $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . ($shipping_weight > 0 ? TEXT_TOTAL_WEIGHT . $shipping_weight . TEXT_PRODUCT_WEIGHT_UNIT : '') . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total()); break; case (SHOW_TOTALS_IN_CART == '3'): $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total()); break; } // testing/debugging // require(DIR_WS_MODULES . 'debug_blocks/shopping_cart_contents.php'); $flagHasCartContents = ($_SESSION['cart']->count_contents() > 0); $cartShowTotal = $currencies->format($_SESSION['cart']->show_total()); $flagAnyOutOfStock = false; $products = $_SESSION['cart']->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { if (($i/2) == floor($i/2)) { $rowClass="rowEven"; } else { $rowClass="rowOdd"; } switch (true) { case (SHOW_SHOPPING_CART_DELETE == 1): $buttonDelete = true; $checkBoxDelete = false; break; case (SHOW_SHOPPING_CART_DELETE == 2): $buttonDelete = false; $checkBoxDelete = true; break; default: $buttonDelete = true; $checkBoxDelete = true; break; $cur_row++; } // end switch $attributeHiddenField = ""; $attrArray = false; $productsName = $products[$i]['name']; // Push all attributes information in an array if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { if (PRODUCTS_OPTIONS_SORT_ORDER=='0') { $options_order_by= ' ORDER BY LPAD(popt.products_options_sort_order,11,"0")'; } else { $options_order_by= ' ORDER BY popt.products_options_name'; } foreach ($products[$i]['attributes'] as $option => $value) { $attributes = "SELECT popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix FROM " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa WHERE pa.products_id = :productsID AND pa.options_id = :optionsID AND pa.options_id = popt.products_options_id AND pa.options_values_id = :optionsValuesID AND pa.options_values_id = poval.products_options_values_id AND popt.language_id = :languageID AND poval.language_id = :languageID " . $options_order_by; $attributes = $db->bindVars($attributes, ':productsID', $products[$i]['id'], 'integer'); $attributes = $db->bindVars($attributes, ':optionsID', $option, 'integer'); $attributes = $db->bindVars($attributes, ':optionsValuesID', $value, 'integer'); $attributes = $db->bindVars($attributes, ':languageID', $_SESSION['languages_id'], 'integer'); $attributes_values = $db->Execute($attributes); //clr 030714 determine if attribute is a text attribute and assign to $attr_value temporarily if ($value == PRODUCTS_OPTIONS_VALUES_TEXT_ID) { $attributeHiddenField .= zen_draw_hidden_field('id[' . $products[$i]['id'] . '][' . TEXT_PREFIX . $option . ']', $products[$i]['attributes_values'][$option]); $attr_value = htmlspecialchars($products[$i]['attributes_values'][$option], ENT_COMPAT, CHARSET, TRUE); } else { $attributeHiddenField .= zen_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value); $attr_value = $attributes_values->fields['products_options_values_name']; } $attrArray[$option]['products_options_name'] = $attributes_values->fields['products_options_name']; $attrArray[$option]['options_values_id'] = $value; $attrArray[$option]['products_options_values_name'] = $attr_value; $attrArray[$option]['options_values_price'] = $attributes_values->fields['options_values_price']; $attrArray[$option]['price_prefix'] = $attributes_values->fields['price_prefix']; } } //end foreach [attributes] if ( STOCK_CHECK == 'true' ) { // Added to allow individual stock of different attributes unset($attributes); if(is_array($products[$i]['attributes'])){ $attributes = $products[$i]['attributes']; } else { $attributes = ''; } $stock_check = zen_check_stock($products[$i]['id'], $products[$i]['quantity'],$attributes); $flagStockCheck = NULL; if (zen_not_null($stock_check)) { $flagAnyOutOfStock = true; $flagStockCheck = $stock_check; $stockAvailable = zen_get_products_stock($products[$i]['id'], $attributes); } } $linkProductsImage = zen_href_link(zen_get_info_page($products[$i]['id']), 'products_id=' . $products[$i]['id']); $linkProductsName = zen_href_link(zen_get_info_page($products[$i]['id']), 'products_id=' . $products[$i]['id']); $productsImage = (IMAGE_SHOPPING_CART_STATUS == 1 ? zen_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT) : ''); $show_products_quantity_max = zen_get_products_quantity_order_max($products[$i]['id']); $showFixedQuantity = (($show_products_quantity_max == 1 or zen_get_products_qty_box_status($products[$i]['id']) == 0) ? true : false); // $showFixedQuantityAmount = $products[$i]['quantity'] . zen_draw_hidden_field('products_id[]', $products[$i]['id']) . zen_draw_hidden_field('cart_quantity[]', 1); // $showFixedQuantityAmount = $products[$i]['quantity'] . zen_draw_hidden_field('cart_quantity[]', 1); $showFixedQuantityAmount = $products[$i]['quantity'] . zen_draw_hidden_field('cart_quantity[]', $products[$i]['quantity']); $showMinUnits = zen_get_products_quantity_min_units_display($products[$i]['id']); $quantityField = zen_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"'); $buttonUpdate = ((SHOW_SHOPPING_CART_UPDATE == 1 or SHOW_SHOPPING_CART_UPDATE == 3) ? zen_image_submit(ICON_IMAGE_UPDATE, ICON_UPDATE_ALT) : '') . zen_draw_hidden_field('products_id[]', $products[$i]['id']); $tmp = zen_add_tax($products[$i]['final_price'],zen_get_tax_rate($products[$i]['tax_class_id'])); // $productsPriceEach = $currencies->rateAdjusted($tmp); // $productsPriceTotal = $productsPriceEach * $products[$i]['quantity']; $productsPriceTotal = $currencies->display_price($products[$i]['final_price'], zen_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : ''); $productsPriceEach = $currencies->display_price($products[$i]['final_price'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : ''); // $productsPriceTotal = $currencies->display_price($products[$i]['final_price'], zen_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : ''); // echo $currencies->rateAdjusted($tmp); $productArray[$i] = array('attributeHiddenField'=>$attributeHiddenField, 'stockAvailable'=>$stockAvailable, 'flagStockCheck'=>$flagStockCheck, 'flagShowFixedQuantity'=>$showFixedQuantity, 'linkProductsImage'=>$linkProductsImage, 'linkProductsName'=>$linkProductsName, 'productsImage'=>$productsImage, 'productsName'=>$productsName, 'showFixedQuantity'=>$showFixedQuantity, 'showFixedQuantityAmount'=>$showFixedQuantityAmount, 'showMinUnits'=>$showMinUnits, 'quantityField'=>$quantityField, 'buttonUpdate'=>$buttonUpdate, 'productsPrice'=>$productsPriceTotal, 'productsPriceEach'=>$productsPriceEach, 'rowClass'=>$rowClass, 'buttonDelete'=>$buttonDelete, 'checkBoxDelete'=>$checkBoxDelete, 'id'=>$products[$i]['id'], 'attributes'=>$attrArray); } // end FOR loop // This should be last line of the script: $zco_notifier->notify('NOTIFY_HEADER_END_SHOPPING_CART'); ?>
31 Mar 2011, 2:28 PM
#1128
athena avatar

athena

Totally Zenned

Join Date:
Jan 2006
Location:
NM
Posts:
740
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Same issue solved when I ran the sql statment in the package that modifies the products_attribute_stock table in db. This was in the mod package with no explaination. Just went for it and it worked..but the mod still screws up my checkout proceedure. In my stock_by_attributes mod it is called update_1_410.sql

saddlebred:

I've just upgraded my site from 1.3.7 to 1.3.9h and this add-in from 1.4.6 to 1.4.12 and received the following error when I click on the link for stock by attributes under catalog. [select * from products_with_attributes_stock where products_id="66" order by sort ASC;] If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields. I followed the upgreade instructions which stated that I need only replace the files, not make any database upgreades. What do I need to do? Thanks

31 Mar 2011, 8:08 PM
#1129
athena avatar

athena

Totally Zenned

Join Date:
Jan 2006
Location:
NM
Posts:
740
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

OK Chris....that did work but took it from the MULTIADD mod from 2007 that we had running...

Just replaced the /includes/modules/pages/shopping_cart/header_php.php in the AJAX version, with the one from stock by attributes MULTIADD.

The issue with creating the table modifications put everything that did not have attributes to zero.

Some warnings should be included in the mod instructions. This was a nightmare.

5 Apr 2011, 6:38 AM
#1130
ryan2416 avatar

ryan2416

New Zenner

Join Date:
Apr 2011
Posts:
4
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Hi guys,

I'm having an issue with my Zen Cart and Stock by Attributes module. First, here are the versions I have:

Zen Cart v1.3.9h
Stock by Attributes Version: 1.4.12

The stock by attributes seems to work correctly until I present it with a certain situation. For example, I have product "A" with a couple of attributes:

Sizes: x-small, medium, large etc..
Design: name1, name2, etc..

I only have in stock:
30 "A"s in x-small design 1
6 "A"s in medium design 1

Now anytime I have both of these products in my shopping cart and the FIRST one in the list is over the stock limit, it causes all of the rest of the products to show out of stock, even if the second item is not out of stock.

Shopping cart example #1 (works like it should):
30 "A"s in x-small design 1
6 "A"s in medium design 1

Shopping cart example #2 (fails):
31 "A"s in x-small design 1 [OUT OF STOCK]
3 "A"s in medium design 1 [OUT OF STOCK]

Shopping cart example #3 (fails):
7 "A"s in medium design 1 [OUT OF STOCK]
30 "A"s in x-small design 1 [OUT OF STOCK]

Shopping cart example #4 (Correct):
6 "A"s in medium design 1
33 "A"s in x-small design 1 [OUT OF STOCK]

Anyone have an idea how to fix this problem? Or if this is an inherent flaw, where should I look to change the "Out of Stock" shopping cart code?

Thanks in advance. Please let me know if you need additional information.

-Ryan

5 Apr 2011, 12:47 PM
#1131
athena avatar

athena

Totally Zenned

Join Date:
Jan 2006
Location:
NM
Posts:
740
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

I changed all the "Out of Stock" text in my cart by running a case sensitive search being careful to choose the display text incidents of the phrase to "More on Order".

BTW - In case anyone is looking for this file, I fixed many problems, as Chris suggested above, by replacing my includes/modules/pages/shopping_cart/header_php.php with the one below from an earlier version of stock by attributes, namely stock_by_attributes_4-7MULTIADD.

No other modification needed. I'm running 1.3.9h upgrading from 1.3.8a

<?php
/**
 * shopping_cart header_php.php
 *
 * @package page
 * @copyright Copyright 2003-2007 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: header_php.php 0000 2007-12-02 00:00:00Z kuroi $
 */

// This should be first line of the script:
$zco_notifier->notify('NOTIFY_HEADER_START_SHOPPING_CART');

require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
$breadcrumb->add(NAVBAR_TITLE);

// Validate Cart for checkout
$_SESSION['valid_to_checkout'] = true;
$_SESSION['cart_errors'] = '';
$_SESSION['cart']->get_products(true);

if (!$_SESSION['valid_to_checkout']) {
  $messageStack->add('shopping_cart', ERROR_CART_UPDATE . $_SESSION['cart_errors'] , 'caution');
}

// build shipping with Tare included
$shipping_weight = $_SESSION['cart']->show_weight();
/*
  $shipping_weight = 0;
  require(DIR_WS_CLASSES . 'order.php');
  $order = new order;
  require_once('includes/classes/http_client.php'); // shipping in basket
  $total_weight = $_SESSION['cart']->show_weight();
  $total_count = $_SESSION['cart']->count_contents();
  require(DIR_WS_CLASSES . 'shipping.php');
  $shipping_modules = new shipping;
  $quotes = $shipping_modules->quote();
*/
$totalsDisplay = '';
switch (true) {
  case (SHOW_TOTALS_IN_CART == '1'):
  $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . TEXT_TOTAL_WEIGHT . $shipping_weight . TEXT_PRODUCT_WEIGHT_UNIT . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
  break;
  case (SHOW_TOTALS_IN_CART == '2'):
  $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . ($shipping_weight > 0 ? TEXT_TOTAL_WEIGHT . $shipping_weight . TEXT_PRODUCT_WEIGHT_UNIT : '') . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
  break;
  case (SHOW_TOTALS_IN_CART == '3'):
  $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
  break;
}

// testing/debugging
//  require(DIR_WS_MODULES . 'debug_blocks/shopping_cart_contents.php');

$flagHasCartContents = ($_SESSION['cart']->count_contents() > 0);
$cartShowTotal = $currencies->format($_SESSION['cart']->show_total());

$flagAnyOutOfStock = false;
$products = $_SESSION['cart']->get_products();
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
  if (($i/2) == floor($i/2)) {
    $rowClass="rowEven";
  } else {
    $rowClass="rowOdd";
  }
  switch (true) {
    case (SHOW_SHOPPING_CART_DELETE == 1):
    $buttonDelete = true;
    $checkBoxDelete = false;
    break;
    case (SHOW_SHOPPING_CART_DELETE == 2):
    $buttonDelete = false;
    $checkBoxDelete = true;
    break;
    default:
    $buttonDelete = true;
    $checkBoxDelete = true;
    break;
    $cur_row++;
  } // end switch
  $attributeHiddenField = "";
  $attrArray = false;
  $productsName = $products[$i]['name'];

  if (STOCK_CHECK == 'true') {
    $flagStockCheck = zen_check_stock($products[$i]['id'], $products[$i]['quantity']);
    if ($flagStockCheck == true) {
      $flagAnyOutOfStock = true;
    }
	  $stockAvailable = zen_get_products_stock($products[$i]['id']);
  }

  // Push all attributes information in an array
  if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
    if (PRODUCTS_OPTIONS_SORT_ORDER=='0') {
      $options_order_by= ' ORDER BY LPAD(popt.products_options_sort_order,11,"0")';
    } else {
      $options_order_by= ' ORDER BY popt.products_options_name';
    }
    foreach ($products[$i]['attributes'] as $option => $value) {
      $attributes = "SELECT popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix
                     FROM " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
                     WHERE pa.products_id = :productsID
                     AND pa.options_id = :optionsID
                     AND pa.options_id = popt.products_options_id
                     AND pa.options_values_id = :optionsValuesID
                     AND pa.options_values_id = poval.products_options_values_id
                     AND popt.language_id = :languageID
                     AND poval.language_id = :languageID " . $options_order_by;

      $attributes = $db->bindVars($attributes, ':productsID', $products[$i]['id'], 'integer');
      $attributes = $db->bindVars($attributes, ':optionsID', $option, 'integer');
      $attributes = $db->bindVars($attributes, ':optionsValuesID', $value, 'integer');
      $attributes = $db->bindVars($attributes, ':languageID', $_SESSION['languages_id'], 'integer');
      $attributes_values = $db->Execute($attributes);
      //clr 030714 determine if attribute is a text attribute and assign to $attr_value temporarily
      if ($value == PRODUCTS_OPTIONS_VALUES_TEXT_ID) {
        $attributeHiddenField .= zen_draw_hidden_field('id[' . $products[$i]['id'] . '][' . TEXT_PREFIX . $option . ']',  $products[$i]['attributes_values'][$option]);
        $attr_value = $products[$i]['attributes_values'][$option];
      } else {
        $attributeHiddenField .= zen_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
        $attr_value = $attributes_values->fields['products_options_values_name'];
      }

      $attrArray[$option]['products_options_name'] = $attributes_values->fields['products_options_name'];
      $attrArray[$option]['options_values_id'] = $value;
      $attrArray[$option]['products_options_values_name'] = zen_output_string_protected($attr_value) ;
      $attrArray[$option]['options_values_price'] = $attributes_values->fields['options_values_price'];
      $attrArray[$option]['price_prefix'] = $attributes_values->fields['price_prefix'];
    }

		if ( STOCK_CHECK == 'true' ) {

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

			// End change

			$stock_check = zen_check_stock($products[$i]['id'], $products[$i]['quantity'],$attributes);
	
			if (zen_not_null($stock_check))
			{
				$flagAnyOutOfStock = true;
				$flagStockCheck = $stock_check;
			  $stockAvailable = zen_get_products_stock($products[$i]['id'], $attributes);		
			}
		}
  } //end foreach [attributes]
  $linkProductsImage = zen_href_link(zen_get_info_page($products[$i]['id']), 'products_id=' . $products[$i]['id']);
  $linkProductsName = zen_href_link(zen_get_info_page($products[$i]['id']), 'products_id=' . $products[$i]['id']);
  $productsImage = (IMAGE_SHOPPING_CART_STATUS == 1 ? zen_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT) : '');
  $show_products_quantity_max = zen_get_products_quantity_order_max($products[$i]['id']);
  $showFixedQuantity = (($show_products_quantity_max == 1 or zen_get_products_qty_box_status($products[$i]['id']) == 0) ? true : false);
//  $showFixedQuantityAmount = $products[$i]['quantity'] . zen_draw_hidden_field('products_id[]', $products[$i]['id']) . zen_draw_hidden_field('cart_quantity[]', 1);
//  $showFixedQuantityAmount = $products[$i]['quantity'] . zen_draw_hidden_field('cart_quantity[]', 1);
  $showFixedQuantityAmount = $products[$i]['quantity'] . zen_draw_hidden_field('cart_quantity[]', $products[$i]['quantity']);
  $showMinUnits = zen_get_products_quantity_min_units_display($products[$i]['id']);
  $quantityField = zen_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"');
  $buttonUpdate = ((SHOW_SHOPPING_CART_UPDATE == 1 or SHOW_SHOPPING_CART_UPDATE == 3) ? zen_image_submit(ICON_IMAGE_UPDATE, ICON_UPDATE_ALT) : '') . zen_draw_hidden_field('products_id[]', $products[$i]['id']);
  $productsPrice = $currencies->display_price($products[$i]['final_price'], zen_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');
  $productsPriceEach = $currencies->display_price($products[$i]['final_price'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');
  $productArray[$i] = array('attributeHiddenField'=>$attributeHiddenField,
                            'flagStockCheck'=>$flagStockCheck,
                            'flagShowFixedQuantity'=>$showFixedQuantity,
                            'linkProductsImage'=>$linkProductsImage,
                            'linkProductsName'=>$linkProductsName,
                            'stockAvailable'=>$stockAvailable,
                            'productsImage'=>$productsImage,
                            'productsName'=>$productsName,
                            'showFixedQuantity'=>$showFixedQuantity,
                            'showFixedQuantityAmount'=>$showFixedQuantityAmount,
                            'showMinUnits'=>$showMinUnits,
                            'quantityField'=>$quantityField,
                            'buttonUpdate'=>$buttonUpdate,
                            'productsPrice'=>$productsPrice,
                            'productsPriceEach'=>$productsPriceEach,
                            'rowClass'=>$rowClass,
                            'buttonDelete'=>$buttonDelete,
                            'checkBoxDelete'=>$checkBoxDelete,
                            'id'=>$products[$i]['id'],
                            'attributes'=>$attrArray);
} // end FOR loop


// This should be last line of the script:
$zco_notifier->notify('NOTIFY_HEADER_END_SHOPPING_CART');
?>
7 Apr 2011, 12:34 AM
#1132
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,688
Plugin Contributions:
56

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

If you are running 1.3.9h and have upgraded to Stock By Attributes 4.1.12:
Please update includes/modules/pages/shopping_cart/header_php.php with the copy from Stock By Attributes 1.4.13

Thanks to Stephen Hewitson for reporting this issue.

7 Apr 2011, 1:21 PM
#1133
athena avatar

athena

Totally Zenned

Join Date:
Jan 2006
Location:
NM
Posts:
740
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

I replaced my file with your new version but still have an issue with the product with attributes affecting the stock tally in the product without in the shopping cart.

Worked a lot on this last night trying to see what consequences were of the page as many here have solved the problem in different ways. My shopping cart works best without these issues if I keep the header_php.php file from the MULTIADD mod as in my post above.

Any suggestions, as I'd like to use the newest files in my 1.3.9h cart. thanks.

7 Apr 2011, 1:56 PM
#1134
swamyg1 avatar

swamyg1

Zen Follower

Join Date:
Dec 2008
Location:
San Fran
Posts:
382
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

athena:

I replaced my file with your new version but still have an issue with the product with attributes affecting the stock tally in the product without in the shopping cart.

Worked a lot on this last night trying to see what consequences were of the page as many here have solved the problem in different ways. My shopping cart works best without these issues if I keep the header_php.php file from the MULTIADD mod as in my post above.

Any suggestions, as I'd like to use the newest files in my 1.3.9h cart. thanks.

Agreed, I had the same problems and did just as you suggested in this thread... thank you for the suggestion!

7 Apr 2011, 11:23 PM
#1135
slender1 avatar

slender1

New Zenner

Join Date:
Apr 2011
Posts:
2
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

ryan2416:

Hi guys,

I'm having an issue with my Zen Cart and Stock by Attributes module. First, here are the versions I have:

Zen Cart v1.3.9h
Stock by Attributes Version: 1.4.12

The stock by attributes seems to work correctly until I present it with a certain situation. For example, I have product "A" with a couple of attributes:

Sizes: x-small, medium, large etc..
Design: name1, name2, etc..

I only have in stock:
30 "A"s in x-small design 1
6 "A"s in medium design 1

Now anytime I have both of these products in my shopping cart and the FIRST one in the list is over the stock limit, it causes all of the rest of the products to show out of stock, even if the second item is not out of stock.

Shopping cart example #1 (works like it should):
30 "A"s in x-small design 1
6 "A"s in medium design 1

Shopping cart example #2 (fails):
31 "A"s in x-small design 1 [OUT OF STOCK]
3 "A"s in medium design 1 [OUT OF STOCK]

Shopping cart example #3 (fails):
7 "A"s in medium design 1 [OUT OF STOCK]
30 "A"s in x-small design 1 [OUT OF STOCK]

Shopping cart example #4 (Correct):
6 "A"s in medium design 1
33 "A"s in x-small design 1 [OUT OF STOCK]

Anyone have an idea how to fix this problem? Or if this is an inherent flaw, where should I look to change the "Out of Stock" shopping cart code?

Thanks in advance. Please let me know if you need additional information.

-Ryan

I am having the same exact problem. When the FIRST one in the list is over the stock limit, it causes all of the rest of the products to show out of stock, even if the second item is not out of stock.

I been working on fixing and reinstalling for 2 weeks to no avail. Anyone know how to fix this?

8 Apr 2011, 1:16 PM
#1136
athena avatar

athena

Totally Zenned

Join Date:
Jan 2006
Location:
NM
Posts:
740
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

the fix in my post above works for me.

let me know if it doesn't work for you. I have fudged with this issue for several weeks as well and keep going back to the old header_php.php file in order to keep my store running. We've had no problems with it...but i would just like a modern solution for my new 1.3.9h install.

8 Apr 2011, 2:15 PM
#1137
derek_bryant avatar

derek_bryant

Zen Follower

Join Date:
Jul 2008
Location:
Bristol UK
Posts:
162
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

**Stock by Attributes v1_4_10 Zen 138a stock not subtracting **--------------------------------------------------------------------------------

Installed the above version of Stock by Attributes but the stock is not subtracting (appropriate admin switch set true)

Searching the threads for hours - please can anyone point me in the right direction

thanks

Derek

8 Apr 2011, 2:32 PM
#1138
athena avatar

athena

Totally Zenned

Join Date:
Jan 2006
Location:
NM
Posts:
740
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

I'm in the same boat as you so am asking...

Did you install the new mod for 1.3.9h or did you install the header_php.php file from my post which comes with an earlier mod?

8 Apr 2011, 2:53 PM
#1139
derek_bryant avatar

derek_bryant

Zen Follower

Join Date:
Jul 2008
Location:
Bristol UK
Posts:
162
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

I downloaded v1_4_10 and uploaded (after installing the SQl file) the files without any modification

Derek

8 Apr 2011, 4:03 PM
#1140
athena avatar

athena

Totally Zenned

Join Date:
Jan 2006
Location:
NM
Posts:
740
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

There is a very current version for 1.3.9h

an ongoing issue is that the file in includes/modules/pages/shopping_cart/header_php.php is faulty....still

everyone here has tried a variety of fixes. the one that worked for me and has my store up and running with no issues is a clean install of the newest Stock by Attributes which is version 1.4.13 only subsititute this problem file in includes/modules/pages/shopping cart/ with a header from an earlier version, namely the one I put in code quotations above.