New Zenner
- Join Date:
- Jun 2005
- Posts:
- 65
- Plugin Contributions:
- 0
Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Ran the update_1_4_10.sql update and it fixed the problem :)
Views: 658,355
New Zenner
Ran the update_1_4_10.sql update and it fixed the problem :)
Zen Follower
I installed the stock by attribute mod, but for some reason it's not showing the attribute for people to pick there size Example:
I have a dress with the sizes: Small, Medium & Large, but on the product page I'm not able to pick the sizes.
How can I correct this issue?
Is there any correction to this problem??????????????????
Zen Follower
I don't know what happened but I did a system restore from my backup & my sizes are showing back up again:clap:
New Zenner
on the page Admin/Catalog/Products With Attributes Stock, the ajax "save" button doesn't work in tested browsers Chrome or IE, only Firefox. I haven't debugged this.
when save button working (in FireFox) the save code is in error:
.../admin/includes/classes/products_with_attributes_stock.php
Fix line 227
// replace hard-coded table name with Zen Cart configured table name
$sql = "UPDATE " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " SET quantity = '$value' WHERE stock_id =$id LIMIT 1";
// current code
// $sql = "UPDATE products_with_attributes_stock SET quantity = '$value' WHERE products_with_attributes_stock.stock_id =$id LIMIT 1";
Email sent to That Software Guy.
If anyone's debugged the JavaScript for the save button in other browsers, please let me know.
Thanks!
New Zenner
Bug on Version: 1.4.13 version??
http://www.zen-cart.com/index.php?main_page=product_contrib_info&cPath=40_47&products_id=310
example:
How i get this
1146 Table 'jazzifas_zc1.products_with_attributes_stock' doesn't exist
in:
[UPDATE products_with_attributes_stock SET quantity = '1' WHERE products_with_attributes_stock.stock_id =21 LIMIT 1]
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.
My DB Have define('DB_PREFIX', 'zen_');
New Zenner
Just wondering if anyone had a work around or fix to show what attributes were still in stock on the product page? The system works great, but at the product page say for example if there were 4 different colours of a top, and only 1 colour was in stock, the stock control will say 1 is in stock but the customer wont know until they try to add the product and goto the next screen, then have to go back again and try another.
I have had a search, and dont think ive missed an answer to this if there was one.
Any thoughts would be greatly appreciated
Thanks
Sam
Totally Zenned
delia:
Installed 1.4.13 and resynced quantities and it took the stock quantities of the main product to zero throughout the entire cart. If you have used this version and not had any problems with the quantity sync please let me know! If this is typical of this version, it has a major problem!
Yes this is typical when upgrading and there should be a warning. Some features of how attributes are set up have changed for us with this mod.
This mod, 1.4.13 is not stable.
There are problems and fixes in this thread for this mod but the latest contributor to this version has not responded to the issues it has.
Look though my posts for some solutions.
Totally Zenned
markcarranza:
on the page Admin/Catalog/Products With Attributes Stock, the ajax "save" button doesn't work in tested browsers Chrome or IE, only Firefox. I haven't debugged this.
when save button working (in FireFox) the save code is in error:
.../admin/includes/classes/products_with_attributes_stock.php
Fix line 227
// replace hard-coded table name with Zen Cart configured table name
$sql = "UPDATE " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " SET quantity = '$value' WHERE stock_id =$id LIMIT 1";
// current code
// $sql = "UPDATE products_with_attributes_stock SET quantity = '$value' WHERE products_with_attributes_stock.stock_id =$id LIMIT 1";
>
> Email sent to That Software Guy.
>
> If anyone's debugged the JavaScript for the save button in other browsers, please let me know.
>
> Thanks!
That's not a javascript fix and is not browser specific. That Software Guy did not write the mod by the way.
Totally Zenned
He seems to be the most recent contributor to any fixes with it according to his post - he believed he had fixed any issues with the mod and thanked someone for reporting an issue...however, the issues still exist.
Do we know who is interested in perfecting this mod, because as I told him I'd be willing to help test it as I have a test cart set up. Just PM me and I'll try and give good feedback.
New Zenner
I am having a huge problem with the shopping cart that I believe it is related to Stock by Attribute:
When my client selects more quantity than available from a product, it doesn't warn with *** (quantity exceeds availability) as it used to. Instead it just "freezes" and doesn't allow to continue the checkout but it doesn't warn that there is insufficient products.
I really have no clue how to solve this, the debug doesn't show any special error apart from:
[03-Jul-2011 06:33:25] PHP Warning: implode() [<a href='function.implode'>function.implode</a>]: Invalid arguments passed in /home/admin/includes/functions/general.php on line 1509
and stock_attributes = '".implode(',', $attr_array)."'
and
[03-Jul-2011 08:19:27] PHP Parse error: syntax error, unexpected T_STRING in /home/includes/languages/portugues/time_out.php on line 1
but the shopping cart is all messed up. Maybe the files could be:
admin/includes/functions/general.php
includes/templates/template_default/templates/tpl_shopping_cart_default.php
Any help would be greatly appreciated as I can hardly take any order from a customer now
Totally Zenned
What version of zen cart and what version of stock by attributes?
New Zenner
Thank you for your fast reply:
Zen Cart v1.3.9h
SBA almost sure it is stock_by_attributes_1.4.13
New Zenner
One example of how unreliable became the Shopping cart:
I have 3 product A, 2 product B with attribute X, and 3 product C.
If I add 5 product A to shopping cart, it doesn't warn the ammount is superior than available and when I click proceed checkout nothing happens.
But if I add 100 product A, 3 product B X and 1 product C, the product A is OK, product B gets *** Quantity required more than available and product C ALSO gets *** Quantity required more than available.
It doesn't make any sense and I browsed the thread for hours and haven't found similar problems.
Totally Zenned
tesefoti:
[03-Jul-2011 06:33:25] PHP Warning: implode() [<a href='function.implode'>function.implode</a>]: Invalid arguments passed in /home/admin/includes/functions/general.php on line 1509
That's the first concern. Be sure that you have uploaded the general.php file from the 1.4.13 release.
Other reported problems with the version before concerned the shopping cart.
Kinda sounds like you don't have the correct version or that not all was uploaded.
Best is to upload that version completely again.
New Zenner
Since it overwrites
admin/orders.php
admin/includes/functions/general.php
includes/classes/order.php
includes/functions/functions_lookups.php
includes/modules/pages/checkout_shipping/header_php.php
includes/modules/pages/shopping_cart/header_php.php
Should I use winmerge to check if it won't delete information from other addons? Thanks!
Totally Zenned
Two common problems to check are whether the files that need to be overwritten, were actually overwritten (timestamps on the server can be useful for this) and whether you have overwritten changes made by other add-ons which are now misbehaving.
Totally Zenned
tesefoti:
Since it overwrites
Should I use winmerge to check if it won't delete information from other addons? Thanks!
Of course, however, if you merged those files before, doing it again may not resolve the problem. Part of this is about testing. Save your version of general.php. Upload the version from the mod. See if that error message goes away. Then on to the other files.
Small steps can highlight the problem with the mod. If a problem resolves, you may easily pinpoint the problem after the fact. Compare the verison of general.php with the old version to see what the differences are. Most of the time the changes will be highlighted with the mod name. Then you can say , oh, I didn't upload that correct file or it was merged wrong, etc.
I find that to be more enlightening in the end.
I use timestamp dates as Kuroi suggested heavily when upgrading a cart so that can also be useful under the right circumstances. I keep multiple versions of mods on my computer so uploading sometimes is not a question of when I did it as which version did I actually use.
New Zenner
I updated and uploaded SBA file by file and the shopping cart is still wrong.
I believe it is something with the code of the shopping cart, the quantities are all mixed up. Here is a screenshot:

It doesn't make any sense. I have like 10 Daily Formula and it accepts 75, 5 Flaxseed and it accepts 100, 3 animal pak and it accepts 5, 2 Casein and it doesn't accept 5, but then 2 alpha lipoic and it doesn't accept 1!
The checkout is simply not working so it will be pure luck to get orders now.
New Zenner
I deleted the overwritten files
admin/orders.php
admin/includes/functions/general.php
includes/classes/order.php
includes/functions/functions_lookups.php
includes/modules/pages/checkout_shipping/header_php.php
includes/modules/pages/shopping_cart/header_php.php
includes/templates/template_default/templates/tpl_shopping_cart_default.php
and uploaded them from an older backup, prior to SBA installation. The quantities don't get error again, if they exceed what's available it warns with ***. I suppose I kinda uninstalled the SBA?
I do need to use SBA though since the attributes make a difference in this business. Does anybody has the same problem than me? Wouldn't it be a bug from this version?
Thanks
New Zenner
<?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'); ``` apparently this one fixed it for me! :clap: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:
Fields marked required must be completed.
Tell staff why this post should be reviewed.
Required for login, security, and core site functionality.
Help us understand how the site is used so we can improve it.
Used for promotion and personalized campaign measurement.