-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
The array in the ORIGINAL file looks like this:
PHP Code:
// echo $currencies->rateAdjusted($tmp);
$productArray[$i] = array('attributeHiddenField'=>$attributeHiddenField,
'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
Just ADD the element to the existing list: (see second listing in the code below...)
PHP Code:
// 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
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Thanks for the clarification (and the code.. :smile:)
Quote:
Originally Posted by
schoolboy
The array in the ORIGINAL file looks like this:
PHP Code:
// echo $currencies->rateAdjusted($tmp);
$productArray[$i] = array('attributeHiddenField'=>$attributeHiddenField,
'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
Just ADD the element to the existing list: (see second listing in the code below...)
PHP Code:
// 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
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Hi I have downloaded the files and unzipped etc but there is no
includes/modules/YOUR_TEMPLATE
instead there is only
includes/modules/pages
I have gone ahead and renamed this to estorenow and uploaded admin and includes to the root of my install but nothing seems to have happened. I've checked under catalog and there's nothing new...
Am I doing something wrong?
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
luke_pickering
Hi I have downloaded the files and unzipped etc but there is no
includes/modules/YOUR_TEMPLATE
instead there is only
includes/modules/pages
I have gone ahead and renamed this to estorenow and uploaded admin and includes to the root of my install but nothing seems to have happened. I've checked under catalog and there's nothing new...
Am I doing something wrong?
You should have an includes/modules/(your template name). In my case it's a folder called template_default.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
ChrisD24
You should have an includes/modules/(your template name). In my case it's a folder called template_default.
And you NEVER want to put ANY module files into or modify ANY files in the default_template folder.. Use a proper template override.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
DivaVocals
And you NEVER want to put ANY module files into or modify ANY files in the default_template folder.. Use a proper template override.
Why's that, because of updates?
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
ChrisD24
Why's that, because of updates?
Yes.. that is the purpose of the overrides system.. You make your changes in the override file. You NEVER modify any of the default_templates files.. There are a number of EXCELLENT tutorials in the Zen Cart FAQs which explain the overrides process..
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Hi,
I am very new to zen-cart (my store isn't finished yet) I have the latest version of zen cart and my host is justhost.com (not sure if that matters but since the cart is installed on there and not on my computer figured I'd mention it.) Anyhow I downloaded this mod (current version), did the sql patch and then from there I am completely lost!! I read the read me and it makes no sense. I don't have an option showing up in admin Catalog->Products with Attributes Stock so what am I doing wrong? PLEASE HELP! my site is balticcreations.net if that helps any? Thanks! Liana
Oh and I should mention what I am wanting to do is add quantities to colors...
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
I would like some guidance with a attribute area. We have pants in various sizes and that have a velcro section and they can choose one of two patches to go with the pants. I want to have stock for the pants sizes ONLY not the patches as the patches are not dependent on the the pants size.
This issue is basically a "gift wrap" issue like discussed on this topic in 2006 and also in the archive http://www.zen-cart.com/forum/showth...=25987&page=21
But my need is I would like to put this flag of products_attributes_checkstock as indicated in this archive topic but I would like to know what I need to exactly do so I don't mess up my store.
Thanks
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
supersnow
I would like some guidance with a attribute area. We have pants in various sizes and that have a velcro section and they can choose one of two patches to go with the pants. I want to have stock for the pants sizes ONLY not the patches as the patches are not dependent on the the pants size.
This issue is basically a "gift wrap" issue like discussed on this topic in 2006 and also in the archive
http://www.zen-cart.com/forum/showth...=25987&page=21
But my need is I would like to put this flag of products_attributes_checkstock as indicated in this archive topic but I would like to know what I need to exactly do so I don't mess up my store.
Thanks
Does anyone have any idea? I know I am not the only one concerned about this. I just want to know the steps and the files I need to edit etc. Please help!
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
I have a problem with the stock errors on the shopping cart. If a product with an attribute is in the cart is either out of stock or over my stock count, the product is marked with *** correctly. However an item without any attributes doesn't generate an error. I think there is a problem with the code below:
Code:
// 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);
}
}
// 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;
}
}
*/
If I un-comment out the original code, the error problem flips. It will mark the product without the attribute, but in return the product with the attribute is not longer marked. Is there a problem that any can see with the code?
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
what version should we use for 1.3.9h, this one or the version bei creinold?
thanks a lot,
p1lot
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
We're using Zen Cart 1.3.8. I believe I've install Stock by Attributes correctly but we're having 3 problems:
1. Some products work fine yet other show out of stock even though they are in stock. In other words, a blue large t-shirt checks out fine, when the red large t-shirt shows out of stock even though it isn't.
2. Available quantity shows 0 in the shopping even though there are some left. In other words, if someone orders 5 blue large t-shirts and there are 4 in stock, instead available quantity showing 4 it shows 0.
3. If the first product shows out of stock in the cart, subsequently added products also show out of stock even though they are in stock.
Does this sound like in installation problem, or maybe a configuration problem.
Thanks for your help.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
p1lot
what version should we use for 1.3.9h, this one or the version bei creinold?
thanks a lot,
p1lot
the beta 5.0 is what I'm using on 1.3.9h (the one by creinold)
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Hi,
I'm using version 1.4.11 and zen v1.3.9d. I've got a strange situation where if someone adds more of one attribute than is in stock, it gets added to the shopping basket but no message appears to say that there isn't enough stock available. If the user then clicks on the checkout button they are returned to the shopping cart still with no error message.
If someone orders more than the total number of an item (with all attributes stock added together) the correct red message appears in the shopping bart page.
I've done lots of file comparisons but can't figure out what the problem is.
Any ideas?
Many thanks,
Richard
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
rpain
Hi,
I'm using version 1.4.11 and zen v1.3.9d. I've got a strange situation where if someone adds more of one attribute than is in stock, it gets added to the shopping basket but no message appears to say that there isn't enough stock available. If the user then clicks on the checkout button they are returned to the shopping cart still with no error message.
If someone orders more than the total number of an item (with all attributes stock added together) the correct red message appears in the shopping bart page.
I've done lots of file comparisons but can't figure out what the problem is.
Any ideas?
Many thanks,
Richard
THAT is my EXACT problem! Nothing I have listed with attributes tells how many of each item is available! I hope to find the answer too!
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
balticccreations
THAT is my EXACT problem! Nothing I have listed with attributes tells how many of each item is available! I hope to find the answer too!
OK same exact thing here. The products page shows the correct QTY in stock (sum of all attribute levels) but on cart it gives out of stick message and shows qty of 0 - please help!
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
bobcnj
OK same exact thing here. The products page shows the correct QTY in stock (sum of all attribute levels) but on cart it gives out of stick message and shows qty of 0 - please help!
Mine doesn't even do that. It just won't let them check out. It will show how many they added to their cart but not how many are actually available. But on the product page it gives the total number of products available just not how many of each attribute.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
balticccreations
Mine doesn't even do that. It just won't let them check out. It will show how many they added to their cart but not how many are actually available. But on the product page it gives the total number of products available just not how many of each attribute.
I have been messing with this for some time and the problem I am having, besides my previous post is that if I have 2 or more items in my cart and the last product is over the limit or out it marks it correctly, but where it gets tricky is:
Cart (3 items for this example):
Item A
Item B
Item C
If Item A is over the limit, B & C are marked at out of stock. If you go over on item B, it marks B & C out of stock. But if just C is out of stock, then only C is marked. Basically from the item that is actually over or out, anything under it gets marked (even though they may not be).
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
ChrisD24
I have been messing with this for some time and the problem I am having, besides my previous post is that if I have 2 or more items in my cart and the last product is over the limit or out it marks it correctly, but where it gets tricky is:
Cart (3 items for this example):
Item A
Item B
Item C
If Item A is over the limit, B & C are marked at out of stock. If you go over on item B, it marks B & C out of stock. But if just C is out of stock, then only C is marked. Basically from the item that is actually over or out, anything under it gets marked (even though they may not be).
Fixed: http://www.zen-cart.com/forum/showpo...postcount=1001
I put the $flagStockCheck = NULL; after instead of before. :frusty:
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Dear ChrisD24,
I am having the same problem and after making the change as yo mentioned i still have the problem can you please post the code here so i can see if i am doing everything correct:
PHP Code:
// 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))
$flagStockCheck = NULL;
{
$flagAnyOutOfStock = true;
$flagStockCheck = $stock_check;
$stockAvailable = zen_get_products_stock($products[$i]['id'], $attributes);
}
}
// end stock by attributes
this is wat i have and mine still shows out of stock error for item B if Item A is out of stock.
Thank you
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
harmeetsandhu
Dear ChrisD24,
I am having the same problem and after making the change as yo mentioned i still have the problem can you please post the code here so i can see if i am doing everything correct:
PHP Code:
// 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))
$flagStockCheck = NULL;
{
$flagAnyOutOfStock = true;
$flagStockCheck = $stock_check;
$stockAvailable = zen_get_products_stock($products[$i]['id'], $attributes);
}
}
// end stock by attributes
this is wat i have and mine still shows out of stock error for item B if Item A is out of stock.
Thank you
I have $flagStockCheck = NULL; above if (zen_not_null($stock_check))
PHP Code:
$stock_check = zen_check_stock($products[$i]['id'], $products[$i]['quantity'],$attributes);
$flagStockCheck = NULL;
if (zen_not_null($stock_check))
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
I changed mine to exactly as yours but i still get this again:
item A out of stock but Item B is in stock but get the out of stock message and the stock avilable is same as ITEM A.
pulling my hair out now. You got any idea.
Thanks
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Forgot to mention that ITEM B has no attribute attached to it though but if i add any other item so lets say item C with attributes.
It works as expected.
Not getting anywhere with this.
Regards
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
harmeetsandhu
Forgot to mention that ITEM B has no attribute attached to it though but if i add any other item so lets say item C with attributes.
It works as expected.
Not getting anywhere with this.
Regards
Exactly, I am still waiting on an answer for products without attributes. :frusty:
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
I read before that you tried uncommenting the
PHP Code:
/*
if (STOCK_CHECK == 'true') {
$flagStockCheck = zen_check_stock($products[$i]['id'], $products[$i]['quantity']);
if ($flagStockCheck == true) {
$flagAnyOutOfStock = true;
}
}
*/
did that make any difference to you.
Regards
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
harmeetsandhu
I read before that you tried uncommenting the
PHP Code:
/*
if (STOCK_CHECK == 'true') {
$flagStockCheck = zen_check_stock($products[$i]['id'], $products[$i]['quantity']);
if ($flagStockCheck == true) {
$flagAnyOutOfStock = true;
}
}
*/
did that make any difference to you.
Regards
Only if I want to have the attributes stock break. Hopefully someone out there can figure this bug out - glad I am not the only one!
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Removing the post as the change i mentioned doesnt work.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Actually wrote to soon:
It doesnt work as the item i choose to test had an attribute. the one without attributes still have this problem :frusty:
will try and sort this out will let u know if i can find the bug.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
harmeetsandhu
Actually wrote to soon:
It doesnt work as the item i choose to test had an attribute. the one without attributes still have this problem :frusty:
will try and sort this out will let u know if i can find the bug.
Nope - I don't think it changed anything. It doesn't show the out of stock/low stock warning nor mark the product with ***. But I think it did that before I tried that code.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
harmeetsandhu
Actually wrote to soon:
It doesnt work as the item i choose to test had an attribute. the one without attributes still have this problem :frusty:
will try and sort this out will let u know if i can find the bug.
LOL Ok that would be great if you can find a way!
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
ChrisD24,
Read the whole code properly and then decided that the following part of the code is an overkill.
I simply removed this part below :
PHP Code:
// 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'];
$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);
}
} else {
$attributes = '';
$flagStockCheck = zen_check_stock($products[$i]['id'], $products[$i]['quantity']);
if ($flagStockCheck == true) {
$flagAnyOutOfStock = true;
$stockAvailable = zen_get_products_stock($products[$i]['id']
}
}
}
and replaced it with this code:
PHP Code:
if (STOCK_CHECK == 'true') {
$flagStockCheck = zen_check_stock($products[$i]['id'], $products[$i]['quantity'], $attributes);
if ($flagStockCheck == true) {
$flagAnyOutOfStock = true;
$stockAvailable = zen_get_products_stock($products[$i]['id'], $attributes);
}
}
This works perfect for me. Try it out and let me know.
Regards
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
harmeetsandhu
ChrisD24,
Read the whole code properly and then decided that the following part of the code is an overkill.
I simply removed this part below :
PHP Code:
// 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'];
$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);
}
} else {
$attributes = '';
$flagStockCheck = zen_check_stock($products[$i]['id'], $products[$i]['quantity']);
if ($flagStockCheck == true) {
$flagAnyOutOfStock = true;
$stockAvailable = zen_get_products_stock($products[$i]['id']
}
}
}
and replaced it with this code:
PHP Code:
if (STOCK_CHECK == 'true') {
$flagStockCheck = zen_check_stock($products[$i]['id'], $products[$i]['quantity'], $attributes);
if ($flagStockCheck == true) {
$flagAnyOutOfStock = true;
$stockAvailable = zen_get_products_stock($products[$i]['id'], $attributes);
}
}
This works perfect for me. Try it out and let me know.
Regards
mine looks like yours does now except I didn't have the last line. Added it in hopes that the stock quantities will show to the customers. Otherwise I'm still stumped.
Nope still not showing them available items for each attribute only how many in total..
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Dear Baltic,
I am not sure if i got ur last post. my cart now works as i wanted it to. It shows no of products avilable if a customer adds in more products then in stock.
Let me know what you refering to and will try to help you out.
Regards
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
balticccreations
Mine doesn't even do that. It just won't let them check out. It will show how many they added to their cart but not how many are actually available. But on the product page it gives the total number of products available just not how many of each attribute.
Quote:
Originally Posted by
harmeetsandhu
Dear Baltic,
I am not sure if i got ur last post. my cart now works as i wanted it to. It shows no of products avilable if a customer adds in more products then in stock.
Let me know what you refering to and will try to help you out.
Regards
Above is what mine is doing. It will show how many total units are available but not how many of each is available. Here is a listing to show you what I mean.
http://balticcreations.net/index.php...11f0435eb21058
it won't let them checkout but also won't give them an error message telling them there is insufficient stock. It doesn't tell them how many are in stock at all aside from the total amount...
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
harmeetsandhu
ChrisD24,
Read the whole code properly and then decided that the following part of the code is an overkill.
I simply removed this part below :
PHP Code:
// 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'];
$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);
}
} else {
$attributes = '';
$flagStockCheck = zen_check_stock($products[$i]['id'], $products[$i]['quantity']);
if ($flagStockCheck == true) {
$flagAnyOutOfStock = true;
$stockAvailable = zen_get_products_stock($products[$i]['id']
}
}
}
and replaced it with this code:
PHP Code:
if (STOCK_CHECK == 'true') {
$flagStockCheck = zen_check_stock($products[$i]['id'], $products[$i]['quantity'], $attributes);
if ($flagStockCheck == true) {
$flagAnyOutOfStock = true;
$stockAvailable = zen_get_products_stock($products[$i]['id'], $attributes);
}
}
This works perfect for me. Try it out and let me know.
Regards
Nope, this doesn't appear to be working for me - just on products without attributes.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Has anyone been able to fix this? I don't want to download this mod and then find I get this problem as too as we really need this mod to work properly because we also have different quantities for products that come in different sizes and colours.
Thanks
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
ChrisD24,
Mine works perfect now. if you paste ur code here i can have a look and see wats going on.
Regards
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
balticccreations,
if you can also paste the code here and i can have a look.
Will try to sort it out.
Regards
harmeet
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
harmeetsandhu
ChrisD24,
Mine works perfect now. if you paste ur code here i can have a look and see wats going on.
Regards
Here is my /shopping_cart/header_php.php file:
PHP Code:
<?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 15880 2010-04-11 16:24:30Z wilt $
*/
// 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'];
}
$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') {
$flagStockCheck = zen_check_stock($products[$i]['id'], $products[$i]['quantity'], $attributes);
if ($flagStockCheck == true) {
$flagAnyOutOfStock = true;
$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,
'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');
?>
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Chris,
That looks perfect but i dont understand why its not working for you. After i made this change this is what happens in my cart:
Item A (with attributes)
Item B (without attributes)
before if Item A is out of stock Item B will be shown out of stock but after i made the chage to the code the cart is fixed and they all come independant with their own stock.
Is this exactly what you trying to achieve.
Harmeet
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
harmeetsandhu
Chris,
That looks perfect but i dont understand why its not working for you. After i made this change this is what happens in my cart:
Item A (with attributes)
Item B (without attributes)
before if Item A is out of stock Item B will be shown out of stock but after i made the chage to the code the cart is fixed and they all come independant with their own stock.
Is this exactly what you trying to achieve.
Harmeet
Right, so both your items A & B get marked with *** independently? Can you post your entire header file and I'll compare and see what's different with a file compare utility? I have made a tweak in other parts of this code so maybe it's something "simple" that's going on here.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Chris,
i compared ur code to min and i can see u have the below part repeated twice
PHP Code:
$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'];
}
$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
Do u know why ???
harmeet
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Ok this is mine:
PHP Code:
<?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') {
$flagStockCheck = zen_check_stock($products[$i]['id'], $products[$i]['quantity'], $attributes);
if ($flagStockCheck == true) {
$flagAnyOutOfStock = true;
$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');
?>
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
harmeetsandhu
balticccreations,
if you can also paste the code here and i can have a look.
Will try to sort it out.
Regards
harmeet
ok thanks here's my full code!
PHP Code:
<?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 $
* Creinold SBA Version 5 update for Zen-Cart 1.3.9H
*/
// 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') {
$flagStockCheck = zen_check_stock($products[$i]['id'], $products[$i]['quantity'], $attributes);
if ($flagStockCheck == true) {
$flagAnyOutOfStock = true;
$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,
'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');
?>
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
harmeet, I don't think my particular issue is in this certain file. I say that because I copied your exact code and replaced it with mine and still had the same problem....
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
harmeetsandhu,
Getting somewhere here. I copied and pasted your entire code and my non attribute products are working, in fact it's actually says how many are left in stock (before it only did that with attributes). But, of course it doesn't mark attribute products out of stock now (which it did before)....
So fix one break another...
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
ChrisD24
harmeetsandhu,
Getting somewhere here. I copied and pasted your entire code and my non attribute products are working, in fact it's actually says how many are left in stock (before it only did that with attributes). But, of course it doesn't mark attribute products out of stock now (which it did before)....
So fix one break another...
Where is it not showing how many are in stock? your actual listings or in the shopping cart? Mine shows how many of everything is available on the listings (the full amount just not how many on the attribute items are available for each attribute).
If the product doesn't have attributes then in the cart it shows an error that says "Products marked with SOLD OUT are out of stock or there are not enough in stock to fill your order.
Please change the quantity of products marked with (SOLD OUT). Thank you" And in the shopping cart shows "SOLD OUT Stock Available: 1"
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
balticccreations
Where is it not showing how many are in stock? your actual listings or in the shopping cart? Mine shows how many of everything is available on the listings (the full amount just not how many on the attribute items are available for each attribute).
If the product doesn't have attributes then in the cart it shows an error that says "Products marked with SOLD OUT are out of stock or there are not enough in stock to fill your order.
Please change the quantity of products marked with (SOLD OUT). Thank you" And in the shopping cart shows "SOLD OUT Stock Available: 1"
In the shopping cart. If you have 3 left and you enter 5 I have it turned on to say how many are left (in the cart). With his code, when a product with an attribute is in the cart it doesn't show give an error about being out of stock (with the ***) and doesn't say how many are left (before it did both with my code). Now with his code, it works properly on products without attributes but does nothing on products with attributes. So something is not right here...:frusty:
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
ChrisD24
In the shopping cart. If you have 3 left and you enter 5 I have it turned on to say how many are left (in the cart). With his code, when a product with an attribute is in the cart it doesn't show give an error about being out of stock (with the ***) and doesn't say how many are left (before it did both with my code). Now with his code, it works properly on products without attributes but does nothing on products with attributes. So something is not right here...:frusty:
I'm thinking our problems are in another file not the header one...
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
this is my stock settings
Stock
Check stock level true
Subtract stock true
Allow Checkout false
Mark product out of stock SOLD OUT
Stock Re-order level 1
Show available stock level in cart when less than order true
Display Images in Admin false
Products status in Catalog when out of stock should be set to 0
Show Sold Out Image in place of Add to Cart 1
Product Quantity Decimals 2
Show Shopping Cart - Delete Checkboxes or Delete Button 3
Show Shopping Cart - Update Cart Button Location 3
Show New Products on empty Shopping Cart Page 1
Show Featured Products on empty Shopping Cart Page 2
Show Special Products on empty Shopping Cart Page 3
Show Upcoming Products on empty Shopping Cart Page 4
Show Notice of Combining Shopping Cart on Login 1
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
balticccreations
I'm thinking our problems are in another file not the header one...
You said:
"If the product doesn't have attributes then in the cart it shows an error that says "Products marked with SOLD OUT are out of stock or there are not enough in stock to fill your order.
Please change the quantity of products marked with (SOLD OUT). Thank you" And in the shopping cart shows "SOLD OUT Stock Available: 1"
Doesn't have attributes, what happens when you have a product that does? Does it mark it in the cart too?
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
ChrisD24
You said:
"If the product doesn't have attributes then in the cart it shows an error that says "Products marked with SOLD OUT are out of stock or there are not enough in stock to fill your order.
Please change the quantity of products marked with (SOLD OUT). Thank you" And in the shopping cart shows "SOLD OUT Stock Available: 1"
Doesn't have attributes, what happens when you have a product that does? Does it mark it in the cart too?
nope then it doesn't list how many are available nor does it let them check out if they want more than are available. Which is a good thing but they can find it to be a problem because it doesn't tell them why they can't check out. For all they know there is enough stock when in fact there isn't.
I tried adding both a product with attributes and a product without to my cart then I made the quantities higher than in stock on both and the one without showed the error I mentioned but the one with showed nothing making it look like they were available but again won't let them check out.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
balticccreations
nope then it doesn't list how many are available nor does it let them check out if they want more than are available. Which is a good thing but they can find it to be a problem because it doesn't tell them why they can't check out. For all they know there is enough stock when in fact there isn't.
I tried adding both a product with attributes and a product without to my cart then I made the quantities higher than in stock on both and the one without showed the error I mentioned but the one with showed nothing making it look like they were available but again won't let them check out.
So we are both on the same page then. I need to get this fixed so it marks both types of products. It has to be this file because with one code it works flawlessly with attribute products, with another it works flawlessly without attributes. Then again why is it working for the other guy...
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
ChrisD24
So we are both on the same page then. I need to get this fixed so it marks both types of products. It has to be this file because with one code it works flawlessly with attribute products, with another it works flawlessly without attributes. Then again why is it working for the other guy...
True. I wonder if he's using a different mod though. I'm using the one by Creinold are you? Also is he on zen-cart 1.3.9h? That's what I'm on. Could make the difference...
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
balticccreations
True. I wonder if he's using a different mod though. I'm using the one by Creinold are you? Also is he on zen-cart 1.3.9h? That's what I'm on. Could make the difference...
I'll have to check on my other computer when I can access it - but I think I am using by dafonz. ZC: 1.3.9g.
This is where I got mine: http://www.zen-cart.com/index.php?ma...roducts_id=310
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
ChrisD24
I'll have to check on my other computer when I can access it - but I think I am using by dafonz. ZC: 1.3.9g.
That could be our difference then for sure...this is mine http://www.zen-cart.com/forum/showthread.php?t=166928
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
balticccreations
Lord help me. I'll have to file compare and see where any differences lie - maybe a solution can be found. But then again, we are using two different versions and having the same outcome. :frusty::frusty::frusty:
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
lol yeah i know its got to be something simple. my issue is it not showing the number available anywhere for each attribute. only the total units available.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
balticccreations
lol yeah i know its got to be something simple. my issue is it not showing the number available anywhere for each attribute. only the total units available.
Only total units available for attribute products in your cart or on the products page?
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
ChrisD24
Only total units available for attribute products in your cart or on the products page?
only on the products page
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
balticccreations
I'll look into this one and see - hopefully it is programmed similarly.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
ChrisD24
I'll look into this one and see - hopefully it is programmed similarly.
let me know what you figure out. I haven't downloaded a file compare system yet so I'm lost lol
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
balticccreations
let me know what you figure out. I haven't downloaded a file compare system yet so I'm lost lol
I'll let you know - it will be a little bit. I'm using KDiff3.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
ChrisD24
I'll let you know - it will be a little bit. I'm using KDiff3.
Thanks! I downloaded it now to figure out how to use it lol
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
balticccreations
Thanks! I downloaded it now to figure out how to use it lol
Holy cow I think I figured it out. Please tell me this works for you!
PHP Code:
<?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');
?>
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
ChrisD24
Holy cow I think I figured it out. Please tell me this works for you!
PHP Code:
<?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');
?>
Still doesn't show on the actual item page how many are available for each attribute but :clap: it does now show the error with quantity if they order more than what's in stock!!!! YAY!!
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Im having issues with this add on. Everything works fine except when you go to checkout it still allows it even though the stock is not there and the setting to allow checkout is set to false. I have implemented the post up above and still im not getting anywhere.
Not sure whats going on :cry:
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
NOJoke
Im having issues with this add on. Everything works fine except when you go to checkout it still allows it even though the stock is not there and the setting to allow checkout is set to false. I have implemented the post up above and still im not getting anywhere.
Not sure whats going on :cry:
Does it disable checkout on non attribute products? Right now I have it where everything works but on attribute product, checkout is still allowed. Ideally, I want the attribute products to be blocked from checking out, but that is just another bug that I'll attempt to fix - but it is a small bug compared to at least warning them to reduce there stock count.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
ChrisD24
Right now I have it where everything works but on attribute product, checkout is still allowed. Ideally, I want the attribute products to be blocked from checking out, but that is just another bug that I'll attempt to fix - but it is a small bug compared to at least warning them to reduce there stock count.
I'll have to make a sold out attribute on mine to see if it will work because I don't have any sold out right now...ill check and see then tell you if mine does that too
ETA works on mine! I set it up on this listing
http://balticcreations.net/index.php...7c3114fa4871ad
the first option "butterscotch" is the sold out one it will now tell them in the cart it is sold out. The ones below it each have 1 item in stock. In the cart it gives an error telling you that the sold out one has 0 in stock and will not allow checkout.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Yeah if it doesnt have an attribute it wont allow checkout if it has an attribute and the qty is more then what we have then it will allow checkout.
Hope this is fixed soon.. dont want to run into problems with any customers
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
NOJoke
Yeah if it doesnt have an attribute it wont allow checkout if it has an attribute and the qty is more then what we have then it will allow checkout.
Hope this is fixed soon.. dont want to run into problems with any customers
which version of the stock by attributes are you using and which version of Zen Cart?
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
balticccreations
which version of the stock by attributes are you using and which version of Zen Cart?
im using 1.3.9h.
if you want you can check it out and see if you can find anything
the link is here
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
oh wait duh you mean the version of the attribute addon(stock_by_attributes_1-4-12). im using the one that was released in november of 2010
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
balticccreations
I'll have to make a sold out attribute on mine to see if it will work because I don't have any sold out right now...ill check and see then tell you if mine does that too
ETA works on mine! I set it up on this listing
http://balticcreations.net/index.php...7c3114fa4871ad
the first option "butterscotch" is the sold out one it will now tell them in the cart it is sold out. The ones below it each have 1 item in stock. In the cart it gives an error telling you that the sold out one has 0 in stock and will not allow checkout.
Wow..it does work.. how did you get that to work like that..:lamo:
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Bleh i tried the new beta version and it worked great for the first product..however the second product not so well.
I think i need to delete the old sql patch that was for the other version to install the one for the new version and possibly input that new code that was posted a few pages back.
But what the issue that I ran into with my site is that I have multiple listings that are going to need an attribute called Size(Adult): with the sizes of course. The first listing works great, the second doesnt because it allows the user to purchase how ever many the final qty is of the total size break down.
If you go here http://sportzdirect.com/shop
and look at the black majestic product it works great because there are only 2 small sizes available and when you hit 3 it says to lower it and it doesnt allow checkout, now if you go to the cardinal majestic product and you go to small and type in 16 it wont allow you to buy anymore since the total for all sizes is 15. You should only be able to buy no more then 3 for that one as well.
I dont know what is going on ...:cry:
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
NOJoke
Bleh i tried the new beta version and it worked great for the first product..however the second product not so well.
I think i need to delete the old sql patch that was for the other version to install the one for the new version and possibly input that new code that was posted a few pages back.
But what the issue that I ran into with my site is that I have multiple listings that are going to need an attribute called Size(Adult): with the sizes of course. The first listing works great, the second doesnt because it allows the user to purchase how ever many the final qty is of the total size break down.
If you go here
http://sportzdirect.com/shop
and look at the black majestic product it works great because there are only 2 small sizes available and when you hit 3 it says to lower it and it doesnt allow checkout, now if you go to the cardinal majestic product and you go to small and type in 16 it wont allow you to buy anymore since the total for all sizes is 15. You should only be able to buy no more then 3 for that one as well.
I dont know what is going on ...:cry:
So it's just one product that is acting "strange"? I had an issue where the attributes for a product was (for some reason) not allowing more than 1 to be added when there was plenty of stock and the max was 3.
After trying different things I added a new product to replace it, and then it worked perfectly. I am not sure if this is the case, but it's worth a shot if the stocks by attributes is just not working for this one product you have.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
ChrisD24
So it's just one product that is acting "strange"? I had an issue where the attributes for a product was (for some reason) not allowing more than 1 to be added when there was plenty of stock and the max was 3.
After trying different things I added a new product to replace it, and then it worked perfectly. I am not sure if this is the case, but it's worth a shot if the stocks by attributes is just not working for this one product you have.
Just the one product is not allowing it to use the same attribute as the other.. meaning that the one works fine with it now allowing checkout.. but when i use the same attribute on another product it doesnt work whatsoever
I might have to take and have my site restored a couple days ago and fresh install the sql file and every one of the files but i dont think that has anything to do with it.. idk im getting to my whitts end
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
wow.. now its only working for the one product and not for any other ones after i set the attributes..maybe something is missing from my sql file..does anyone know how to remove the sql that was installed in the 4.0 version and how to replace it with the new sql file?
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
NEW PROBLEM!!! Now my categories aka products page shows this instead of my products when I try to edit
1 Can't create/write to file '/tmp/#sql_ffc_0.MYI' (Errcode: 28)
in:
[select c.categories_id, cd.categories_name, cd.categories_description, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, c.categories_status from zen_categories c, zen_categories_description cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id = '1' order by c.sort_order, cd.categories_name]
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.
like ya said fix one break another lol gotta figure out what went missing!
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
balticccreations
Can't create/write to file '/tmp/#sql_ffc_0.MYI' (Errcode: 28)
That's a problem with your database. It means that mysql believes that it has run out of space (usually physically space, i.e. the hard disk on which it's running is full).
One to discuss with your webhost - as only they can fix it.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
kuroi
That's a problem with your database. It means that mysql believes that it has run out of space (usually physically space, i.e. the hard disk on which it's running is full).
One to discuss with your webhost - as only they can fix it.
THANK YOU!!! I did a check and repair of my database and now its back to normal!
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
balticccreations
THANK YOU!!! I did a check and repair of my database and now its back to normal!
spoke too soon
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Im gonna do a restore on my site to a couple days ago and then re-upload this beta version here and see if it will work fine for me.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Since i updated (new install) my shop to v1.3.9h i have a problem with the stock by attribute add on. Before with the v1.3.8 it was perfect because when for example the pink shirt size XS was out of stock then it wasnīt shown anymore in the dropdown menu. Now the customer canīt check out when selected XS but i like it more when the size is not shown at all in the dropdown menu. Why isnīt it working like that anymore? someone got any idea?
PS: I use the stock by attribute because of different colors and sizes for one product.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
I have tried to search this thread to find an answer to my problem without success, sorry if this has already been answered.
Last time (a month ago or so) I had this mod working perfectly. Now when I click on the link in the admin I am taken to a blank white page in FF and a 500 Internal Server error in IE.
To the best of my knowledge I have not changed anything in the files that run this mod or edited my database in any way that would have effected this mod.
I am just wondering if anyone has seen this problem before. I do know I have a lot of products loaded in this section. Any help is appreciated and more I can offer more info as needed. Thanks!
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Sorry, I should have given a bit more info. I am running v1.3.8a with Stock by Attribute v4.
The only thing I can think of that would be different with my site is that I edited my admin folder from it's previous name of 'admin' to a more secure name. I really don't think this should have any implication on it's functionality, but it is the only thing I can think of that I have changed. Sorry I can be of any more help. Thanks
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Alright, nevermind. I re-uploaded the files for Stock by Attribute and ran the database update and all is working again. I am guessing in my haste I managed to overwrite a file somehow. Also the new version is much easier to read when you have many thousands of product variations! Sorry to take up room in the topic. Thanks
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
I already have this add-on and I think it is time to update it since it keeps selling sizes that are out of stock. Can you please tell me what's the best way to update it? Shall I totally remove the old version? or shall I overwrite certain files?
Thank you!
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
I've installed the 4.7 version on Zen-cart 1.3.9h and it's not working - no stock is being substracted according to my client and also in the stock by attributes page in admin the two lines (overall and variant) do not tally.
The site is set to subtract stock - obvious first question...
I'm not sure how to sort this out - any help or experiences would be appreciated. I've used an earlier version which worked fine..
Andy
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
limelites
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:
PHP Code:
$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 Code:
$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;
I've got a similar requirement on my site - if an attribute is out of stock it should be removed from the radio button list (radio buttons as opposed to dropdowns per the client's request).
This is somewhat complicated by the fact that each product has 2 attributes, so the attribute would only be removed if it's out of stock in ALL combinations.
A good example is this product:
http://www.vkoonyc.com/accessories-c...oop-scarf-p-20
There's only one size, which makes it easy to test. It's out of stock in Mocha and Lt Grey, and I would like both of those attributes to be removed from the radio button list.
I tried limelite's code in attributes.php but it had no effect.
Using Zen Cart 1.3.9h w/ SBA 4.12.
Thanks in advance!
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Solved my own problem! In the end the magic code was this:
Code:
$sql="SELECT DISTINCT pov.products_options_values_id, pov.products_options_values_name, pa. *
FROM " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
LEFT JOIN products_with_attributes_stock pwas ON pwas.stock_attributes REGEXP 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;
Hope that helps someone else!
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
ChrisD24
I had the same problem with items not in stock. It wouldn't let you check out if an item wasn't in stock, but wouldn't tell you why. After banging my head a while I tried your solution. It works!
Thanks so much!
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
There are mixed reviews about whether or not this works.
Does this module work as intended for ZC v1.3.9h.
I am currently using CReinold's v5.0b (w/ AJAX) which isn't working for me as it is allowing customers to add more than that stock quantity remaining into their basket and checkout. (See post: HERE for full description)
Does this version work properly to this aspect?
Thanks for your help.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
The disable option when 0 fix has worked for me, thanks very much.
Chris I want to try your fix but I am failing at the first hurdle as I can't find the correct file to edit, can you confirm the file name and location.
Site is - www.mightcontainnuts.com
Zen Cart - 1.3.9h
Thanks for your help.
Barry.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
OK, another question....is this an accepted limitation of this addon or should it support error messages? It clearly knows the items are not in stock at the required level because it prevents checkout, but does not present an error message for me.
If this is a problem with my configuation then I can look at possible options, if it is a known issue then I may need someone to code a fix, this is a real issue for us and is costing sales.
Any thoughts?
Thanks,
Barry.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Hi There,
I am receiving the following error. could any one help me to find out the problem ..
0
in:
[select pov.products_options_values_id, pov.products_options_values_name, pa.* from products_attributes pa, products_options_values pov where pa.products_id = '22548' and pa.options_id = '2' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '1' order by LPAD(pa.products_options_sort_order,11,"0"), pov.products_options_values_name]
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
I am using a text field for a product which is letters printed to the customers wish. Stock by attributes creates a stock record in the stock by attributes table, but stock is zero and always puts the out of stock message in the cart.
Is there a work around so that stock for a product with a text field like this does not show out of stock. This issue is also true if you have a mix of drop downs eg a name printed on a t-shirt. Customer chooses size of T-shirt and then enters name in a text field. Want to track the stock of the t-shirt by size but not worry about the text for the name.
Does any one else have a similar issue and is there a work around.
Another variation for my situation is products shipped direct.....never has stock but could have a choice of attributes. Again the out of stock message shows in the cart.
Thanks in advance.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
I have another question. If I add quantity for all variants how do I stop it adding variants for display only fields. If I ask it to add qty for all variants and that vaiant exists I think there is a bug as it adds the variant again so I then have the same variant twice.
I have looked through the whole of this thread. Sorry if I have missed the answer to these. I could not see it having been answered.
Thanks
MikeyG