Forums / All Other Contributions/Addons / Stocks by attributes

Stocks by attributes

Locked

Views: 251,699

Results 1,061 to 1,080 of 1,126
This thread is locked. New replies are disabled.
13 May 2011, 5:33 AM
#1061
cooler0918 avatar

cooler0918

New Zenner

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

Stocks by attributes

I had posted on an other thread but I think this is the right one.

I am running 1.39h and I just installed SBA 4.13. Everything appears to be working except 2 issues. One is that my available stock does not show in the shopping cart when the quantity exceeds the current stock level for that attribute. even though the "Show available stock level in cart when less than order" is set to true. I have been comparing all the files 2 to 3 times and I am pretty sure i merged it correctly.

The other issue is more of a behavior problem. I have my setting set to not go to the shopping cart every time you add an item but if the first item added has insufficient stock they all show up as insufficient subsequently.

Any help would be much appreciated. :frusty: :wacko:
Cooler0918

https://www.ahaccessories.com

A&H Accessories, Shop for unique hair and fashion accessories.
Browse barrettes, clips, bows, headbands & more
https://www.ahaccessories.com

13 May 2011, 1:13 PM
#1062
athena avatar

athena

Totally Zenned

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

Re: Stocks by attributes

This is from the other thread....I think this is your issue. The new download still does not fix the stock quantity problem but we have a busy shop that is working now because I replaced the shopping_cart/header_php.php with the one in this quote.

athena:

I'm not a moderator here but this is what worked for me:

Yes, You can over write the files.

for the version you installed i don't think you need to run any additional sql statments

here is the one from the "stock_by_attributes_4-7MULTIADD"

just replace the code in shopping_cart/header_php.php with this:

<?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'); ```
13 May 2011, 2:33 PM
#1063
cooler0918 avatar

cooler0918

New Zenner

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

Re: Stocks by attributes

athena:

This is from the other thread....I think this is your issue. The new download still does not fix the stock quantity problem but we have a busy shop that is working now because I replaced the shopping_cart/header_php.php with the one in this quote.

Thank you very much for your response. I tried merging that header file with mine, which indeed was missing a section but it still does not work so i reversed it.

This is what the contribution file looks like:

<?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']; } // stock by 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); if (zen_not_null($stock_check)) { $flagAnyOutOfStock = true; $flagStockCheck = $stock_check; $stockAvailable = zen_get_products_stock($products[$i]['id'], $attributes); } } // end stock by attributes } //end foreach [attributes] /* if (STOCK_CHECK == 'true') { $flagStockCheck = zen_check_stock($products[$i]['id'], $products[$i]['quantity']); if ($flagStockCheck == true) { $flagAnyOutOfStock = true; } } */ $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, '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'=>$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'); ?>

https://www.ahaccessories.com

A&H Accessories, Shop for unique hair and fashion accessories.
Browse barrettes, clips, bows, headbands & more
https://www.ahaccessories.com

13 May 2011, 4:36 PM
#1064
athena avatar

athena

Totally Zenned

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

Re: Stocks by attributes

I also tried merging it with no success.

My strategy, until someone pays more attention to this being an issue, is to just replace the file with the other to get my shop up and running.

Like you, I prefer to use all the updated files, but so far replacing this one file has been working for us through some busy busy months without fail. I'm sure it will be dealt with eventually by the mod creator.

13 May 2011, 5:01 PM
#1065
cooler0918 avatar

cooler0918

New Zenner

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

Re: Stocks by attributes

athena:

I also tried merging it with no success.

My strategy, until someone pays more attention to this being an issue, is to just replace the file with the other to get my shop up and running.

Like you, I prefer to use all the updated files, but so far replacing this one file has been working for us through some busy busy months without fail. I'm sure it will be dealt with eventually by the mod creator.

The above mentioned is working for me as far as telling the customer that the item qty is higher than the stock available, it just doesn't show them how much stock there is for the attribute.

I guess not having the skills to do it myself I will have to just hope that they address this issue.

Thank you for your responses. :clap:

A&H Accessories, Shop for unique hair and fashion accessories.
Browse barrettes, clips, bows, headbands & more
https://www.ahaccessories.com

19 May 2011, 2:53 PM
#1066
soniccc avatar

soniccc

Zen Follower

Join Date:
May 2010
Location:
Cyberspace
Posts:
387
Plugin Contributions:
0

Re: Stocks by attributes

limelites:

Ahaaaaaaa, figured this one out guys!!

For anyone else having a problem with this issue, just look at re-installing the files that shipped with the stock_by_attributes mod.

I've just cured my problems by overwriting /includes/classes/order.php with the order.php from "stock_by_attributes_4-7MULTIADD mod"

Somehow some other mod had corrupted the data that updates the "Quantity in Stock" in ADMIN>CATALOG>PRODUCTS WITH ATTRIBUTES".

It is now updating the Quantity in Stock Column with each sale. All working perfectly now.

Additionally, if you want the attribute in the drop down menu to automatically disable when the attribute quantity = zero, then you have to open /includes/modules/attributes.php and replace this:

$sql = "select pov.products_options_values_id,
pov.products_options_values_name,
pa.*
from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov
where pa.products_id = '" . (int)$_GET['products_id'] . "'
and pa.options_id = '" . (int)$products_options_names->fields['products_options_id'] . "'
and pa.options_values_id = pov.products_options_values_id
and pov.language_id = '" . (int)$_SESSION['languages_id'] . "' " .
$order_by;

> with this:
> ```php
$sql=	"SELECT  pov.products_options_values_id,
       					 pov.products_options_values_name,
       					 pa.*,
       					 pwas.*
        	    FROM   " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov, " . TABLE_PRODUCTS_ATTRIBUTES . " pa LEFT JOIN " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pwas ON pwas.stock_attributes = pa.products_attributes_id
                WHERE   pa.products_id = '" . (int)$_GET['products_id'] . "'
       			and    pa.options_id = '" . (int)$products_options_names->fields['products_options_id'] . "'
				and    (pwas.quantity > 0 or pwas.quantity IS NULL)
      			and    pa.options_values_id = pov.products_options_values_id
             	and       pov.language_id = '" . (int)$_SESSION['languages_id'] . "' " .
				$order_by;

Thanks!

19 May 2011, 3:18 PM
#1067
athena avatar

athena

Totally Zenned

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

Re: Stocks by attributes

so Sonicc...did you use the current mod or the "stock_by_attributes_4-7MULTIADD mod"?

19 May 2011, 4:22 PM
#1068
soniccc avatar

soniccc

Zen Follower

Join Date:
May 2010
Location:
Cyberspace
Posts:
387
Plugin Contributions:
0

Re: Stocks by attributes

athena:

so Sonicc...did you use the current mod or the "stock_by_attributes_4-7MULTIADD mod"?

Well Athena, I used the latest version (supplied by that software guy) and just made the modifications described above to my includes/modules/attributes.php file. I used the attributes file from ZenCart version 1.39h.

Thanks

19 May 2011, 4:58 PM
#1069
athena avatar

athena

Totally Zenned

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

Re: Stocks by attributes

I hope to go back to this and spend some time trying to figure out why mine works.

It does tell the customer how many are in stock, unlike poster "cooler0918" has going on; but I suspect the file I'm using is just by passing the Ajax function altogether. I've never dealt with Ajax, so have to learn.

It would be nice to have the choice disappear when none are in stock. I'll try your edit to my install, but my orders.php has become way too complicated with all the mods we've installed to just replace it.

Thanks

19 May 2011, 8:40 PM
#1070
soniccc avatar

soniccc

Zen Follower

Join Date:
May 2010
Location:
Cyberspace
Posts:
387
Plugin Contributions:
0

Re: Stocks by attributes

Hope it works!

25 Jun 2011, 2:08 AM
#1071
khopek avatar

khopek

Totally Zenned

Join Date:
Aug 2006
Location:
portlandish, oregon
Posts:
795
Plugin Contributions:
0

Re: Stocks by attributes

I just installed this mod for the first time, and the only issue I am having is that the 'SAVE' button does not seem to be working so it is not registering that attribute quantities were added.

28 Jun 2011, 12:40 AM
#1072
dthomas avatar

dthomas

New Zenner

Join Date:
Feb 2009
Posts:
13
Plugin Contributions:
0

Re: Stocks by attributes

I just added stock by attributes and dynamic drop downs to my website. Now the product detail pages are showing the attribute dropdown at the bottom of the page. More of a problem is the dynamic dropdowns are showing all possible combinations of attributes added for the item regardless of stock. Any ideas where to start trouble shooting this? An example of my problem can be seen here http://verdasport.com/index.php?main_page=product_info&products_id=8.

Any help would be greatly appreciated!

28 Jun 2011, 12:39 PM
#1073
athena avatar

athena

Totally Zenned

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

Re: Stocks by attributes

You should post this wherever assistance is offered on dynamic drop downs mod. This doesn't sound like any common problem I've studied about stock by attributes.

It does sound like a file merging problem. Making sure stock by attributes works the way you want it to by searching this thread (as it is an unstable mod) then starting from scratch with your install of dynamic drop downs after STA is working is my recommendation for what it is worth.

30 Jun 2011, 12:37 AM
#1074
fvb avatar

fvb

Zen Follower

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

Re: Stocks by attributes

khopek:

I just installed this mod for the first time, and the only issue I am having is that the 'SAVE' button does not seem to be working so it is not registering that attribute quantities were added.

I have the same problem

4 Jul 2011, 8:00 PM
#1075
shahram avatar

shahram

Zen Follower

Join Date:
Jul 2009
Location:
New York
Posts:
122
Plugin Contributions:
1

Re: Stocks by attributes

Easy Populate 1.2.5.5 with Stock With Attributes
I am using this mod, I am familiar with Easy populate CSV, but on this one I can’t figure out how to add stock by attributes. Is there a column I need to add to make all the sizes I have appear as having “1” in stock? Do I have to add a column in the main CSV file or in the attributes file?

Thanks for any help

30 Jul 2011, 3:50 AM
#1076
poopyp avatar

poopyp

New Zenner

Join Date:
Sep 2010
Posts:
10
Plugin Contributions:
0

Re: Stocks by attributes

kuroi:

@pjb923

You may be able to implement a hack similar to that done by yellow1912, but in this case to suppress the text attribute from being affected by stock by attribute.

Does anybody know where I can find or what do I have to edit to make Stock by attribute ignore text boxes (similar to the quoted post to ignore readonly boxes)? I have a store that sells shirts and customers can enter the name on a shirt but if they leave it blank it should still process the order if the size is in stock. So If the size is in stock text box values are irrelevant, they are there to tell me the user wants ZENCART on their tshirt.

Your help is greatly appreciated.

31 Jul 2011, 6:49 AM
#1077
slender1 avatar

slender1

New Zenner

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

Re: Stocks by attributes

I did the modifications by Sonicc and come up with the following error: Deleting of product data debris failed! Please see the debug log in your uploads directory for further information.

When I look in ep_debug_log. I get this:

MySQL error 1054: Unknown column 'pwas.quantity' in 'field list'
When executing:
SELECT
p.products_id as v_products_id,
p.products_model as v_products_model,
p.products_price as v_products_price,
p.products_tax_class_id as v_tax_class_id,
p.products_quantity as v_products_quantity,
pa.products_attributes_id as pwas_attrib_id,
pwas.quantity as pwas_products_quantity,
pov.products_options_values_name as v_options_name
FROM
products as p
JOIN
products_attributes as pa
on p.products_id = pa.products_id
JOIN
products_options_values as pov
on pa.options_values_id = pov.products_options_values_id
join products_with_attributes_stock PWAS
on PWAS.stock_attributes = pa.products_attributes_id

I've searched PWAS.quantity and haven't found anyone else having this problem.

Anyone have a clue to what I am doing wrong?
ver 1.3.9h
Easy Populate 1.2.5.5.csv.2

30 Oct 2011, 12:05 AM
#1078
shop4costumes avatar

shop4costumes

New Zenner

Join Date:
Feb 2011
Posts:
16
Plugin Contributions:
0

Re: Stocks by attributes

Hi
I'm struggling to get the EasyPopulate mod to work with this.
I have installed the Stock by Attributes mod. This appears to work fine. I can manually add stock for each attribute.
But manually adding is not going to be practical.
I somehow need to add stock by attribute.

So then I have installed the Easy Populate for Stock with Attributes mod.

I'm doing this on a test copy of the live site.

Do people actually use the EP mod with this or has everyone given up ?
If you have it working would you mind me asking for help ?

It seems to be tring to access a data table without the zen_ prefix.

I have limited skills to fix this but prepared to try!
I renamed the table in phpadmin and then created a different error message (and the admin>stock by attributes screen no longer worked), so reversed change...

Totally stuck

Thanks for anyone who may be able to help ???:hug:

Sarah
https://www.shop4costumes.co.uk

13 Jan 2012, 4:35 AM
#1079
ambers avatar

ambers

New Zenner

Join Date:
Jan 2012
Posts:
1
Plugin Contributions:
0

Re: Stocks by attributes

I just installed and followed everything pretty flawlessly...until I tried to add an item to my cart through my webstore. I'm getting SQL error that says

1146 Table 'archery.TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK' doesn't exist
in:
[select stock_id from TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK where products_id = '204']

PLEASE HELP!
-Amber

14 Jan 2012, 10:47 AM
#1080
jamint avatar

jamint

New Zenner

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

Re: Stocks by attributes

Hi,

Thought this was worth sharing as a spent a long time searching the forums for something like this.

When i was told that our website was being built on Zen Cart and i started to do some research i soon realised that some of the dynamic features that i had expected to be standard in ecommerce now were not going to be easy. I could begin to list them but that is not the purpose of this post.

With the stock by attributes mod i realised after beginning to use it that the standard install really was not very friendly for a lot of our products. For clothing and fashion items which are 1 off seasonal orders and could not be re-ordered we did not want to upset many customers that place an order only to be told that their size or colour was not in stock and we would have to refund them. As with the mod if you have 3 colours and 5 sizes then that is 15 combinations of which we may only have 10 in stock and there was no way for the customer to know if their combination was in stock on the product page. If you add one more attribute then the amount of combinations vs actual stock can become very large. ALL of our products are Stock by Attributes!

So i went on the hunt of a mod that made the Stock by Attributes mod dynamic on the customer end by forcing the customer to select attribute names in order and then only showing the option values of the next attribute that were in stock, this is what most major online retailers use now. For instance customer selects blue shirt, the next drop down is lit up and only 3 out of 5 of the sizes are available for selection. No luck. (If anyone knows of this mod please let me know)

So i approached our developers and they have done something that has helped so far, not perfect, but makes our site a bit more user friendly. Basically when a customer has made all the selections possible an Availability box tells them if it is in stock.

Unfortunately i do not know the ins and outs of how it works but i thought this might help other people who need something like this and were wondering how to get it done or being told by their developers that it was not possible.

Please if there are any better ways of tackling this issue or if you have any suggestions or questions please post it here.

To see how it works visit https://www.redpostequestrian.co.uk and view a product.