Re: Product Attribute Grid
Quote:
Originally Posted by
jagall
thank you again mc12345678 for taking such time in looking at this for me. When I put 5 in the prod unit qty, everything as before multiplied in units of 5, I'll do it again and you can see what I mean, the quantities as you say can be changed in the shopping cart and no warning is giving either. With the plugin it adds the attributes as single products if you like, the checkbox attributes was more defined in ways I think.
Gotcha. So, I have two concepts that would address this by a template modification to accomplish either of the below, or possibly a functions file modification (or of course a combination of the two).
There is a template modification that *is* in this forum but may also be in the instructions (been a spell since I've looked at that aspect) that will make the quantity box effectively 1 without allowing the customer to add multiple quantity of groups from the product information page, but would allow modification on the shopping cart. A next modification would be to allow adding multiple groupings but start with a quantity of 1 instead of the unit/min mix that ZC offers its standard product.
The function modification (a core file edit) would be to return a value of 1 if the product in question has a grid attribute instead of this unit quantity.
A combination style would be to use a new function that is called by a modified template file when there is a unit/min related requirement such that the option could maybe be controlled by some database setting...
As to checkboxes... unfortunately generally speaking they are problematic and best used for a two state situation such as giftwrap or not. It can be factored in as a "quantity" style product, but that requires additional inspection upon submission and handling to identify the errant condition. Not saying it's hard, just more involved.
Re: Product Attribute Grid
Looking at the standard template code, there's a way to use an observer to "force" the add-to-cart button to use a quantity of 1 without modifying the template file.
I also would like to propose to the ZC team a modification to the template that would put the calculation/determination of the zen_get_buy_now quantity into one of the main_template_vars.php for the product type's includes/modules/pages folder.
This would allow modification of the value without touching the template or the core function.
@jagall, take a look at the following commit to github: https://github.com/mc12345678/Attrib...61d243c621ef0c
Which modified only the observer class file: includes/classes/observers/class.attributes_grid_products.php
The entire package can again be downloaded from: https://github.com/mc12345678/Attrib...isable-qty-box
Re: Product Attribute Grid
Has this mod been tested with 1.5.6# and 1.5.7?
Asking for a friend:P
Re: Product Attribute Grid
Quote:
Originally Posted by
dbltoe
Has this mod been tested with 1.5.6# and 1.5.7?
Asking for a friend:P
Just a couple of days ago added to a 1.5.6 site, *did* have to make a few adjustments for more stricter php conditions for when a contact us type product information was displayed.
Basically had a situation where a numerical addition was made to a text field... weird thing to do, I know, but it seemed like the "thing" back then and it "worked"...
Re: Product Attribute Grid
Currently my grid is vertical but I want it horizontal (due to so many options)
How do I do it please?
e.g.
option [ ] option [ ] option [ ] option [ ]
Thanks
Kind Regards
Re: Product Attribute Grid
Hi, I have installed this product, along with SBA on a fresh install of Zencart 1.5.7c.
When I try to add a product with attributes to the shopping cart using the grid format, the product variant won't add, and I get a message telling me that my shopping cart is empty.
Looking at the log files, I get the following:
[20-Mar-2021 18:30:47 Australia/Sydney] Request URI: /index.php?main_page=product_info&cPath=327&products_id=2313&number_of_uploads=0& action=add_product, IP address: 144.139.232.135
#1 include(/home/*****/public_html/includes/extra_cart_actions/attributes_grid_products_extra_cart.php) called at [/home/*****/public_html/includes/main_cart_actions.php:26]
#2 require(/home/*****/public_html/includes/main_cart_actions.php) called at [/home/esboutiq/public_html/includes/init_includes/init_cart_handler.php:44]
#3 require_once(/home/*****/public_html/includes/init_includes/init_cart_handler.php) called at [/home/esboutiq/public_html/includes/autoload_func.php:37]
#4 require(/home/*****/public_html/includes/autoload_func.php) called at [/home/esboutiq/public_html/includes/application_top.php:222]
#5 require(/home/*****/public_html/includes/application_top.php) called at [/home/esboutiq/public_html/index.php:25]
--> PHP Warning: Use of undefined constant FILE_PREFIX - assumed 'FILE_PREFIX' (this will throw an Error in a future version of PHP) in /home/*****/public_html/includes/extra_cart_actions/attributes_grid_products_extra_cart.php on line 78.
I would appreciate any help in finding a solution to the problem. I should add that the problem only occurs when "Grid" is chosen in the Options Name Manager.
Re: Product Attribute Grid
In a way, glad that there's only one logged issue. That issue (assuming that the attribute isn't a file type attribute) wouldn't be expected to be related to the problem of the attribute missing from the cart.
That said, I haven't tested/updated grid attributes for the more recent Zen Cart version(s). But can look at that possibly later today.
There *is* the possibility that the download of SBA may need to be updated because I did briefly have some changes in place for download that supported only evaluating the quantity of available product in a certain way which was non-conformant with how some other plugins were written to interface with SBA.
In the mean time can you gather some data for me?
1. Does the same non-add to cart occur to a product that is setup with the same attributes but not tracked by SBA?
2. What version of Zen Cart?
3. What php version does the cart see?
4. On what date was the SBA package downloaded?
5. What types of attributes make up this product? (one of course is the grid attribute)
Re: Product Attribute Grid
@mc, in briefly looking at this situation, i see NO definition for the constant FILE_PREFIX anywhere in the ZC repo or in the plugins. either the combined or in the product attribute grid.
@donw, you can try commenting out the lines in includes/extra_cart_actions/attributes_grid_products_extra_cart.php starting at lines 78.
PHP Code:
//from
} elseif (substr($option_id, 0, strlen(FILE_PREFIX)) == FILE_PREFIX) {
$option_ref[substr($option_id, strlen(FILE_PREFIX))] = $option_id;
$option_id = substr($option_id, strlen(FILE_PREFIX));
//to
/*
} elseif (substr($option_id, 0, strlen(FILE_PREFIX)) == FILE_PREFIX) {
$option_ref[substr($option_id, strlen(FILE_PREFIX))] = $option_id;
$option_id = substr($option_id, strlen(FILE_PREFIX));
*/
Re: Product Attribute Grid
Quote:
Originally Posted by
carlwhat
@mc, in briefly looking at this situation, i see NO definition for the constant FILE_PREFIX anywhere in the ZC repo or in the plugins. either the combined or in the product attribute grid.
@donw, you can try commenting out the lines in includes/extra_cart_actions/attributes_grid_products_extra_cart.php starting at lines 78.
PHP Code:
//from
} elseif (substr($option_id, 0, strlen(FILE_PREFIX)) == FILE_PREFIX) {
$option_ref[substr($option_id, strlen(FILE_PREFIX))] = $option_id;
$option_id = substr($option_id, strlen(FILE_PREFIX));
//to
/*
} elseif (substr($option_id, 0, strlen(FILE_PREFIX)) == FILE_PREFIX) {
$option_ref[substr($option_id, strlen(FILE_PREFIX))] = $option_id;
$option_id = substr($option_id, strlen(FILE_PREFIX));
*/
That was from a point "silent" protest to the absence of the define as in a default installation TEXT_PREFIX and UPLOAD_PREFIX are the same value. As a result of that fact, for a default installation the above commenting out of code won't hurt anything. It still though doesn't explain the situation of the product not being added to the cart.
That said, some interim changes I've locally made included a test for FILE_PREFIX being defined and in the previous if statement to verify that TEXT_PREFIX is also defined.
What should happen here though for the widest compatibility is for the above FILE_PREFIX to be changed to UPLOAD_PREFIX:
Code:
} elseif (defined('UPLOAD_PREFIX') && substr($option_id, 0, strlen(UPLOAD_PREFIX)) == UPLOAD_PREFIX) {
$option_ref[substr($option_id, strlen(UPLOAD_PREFIX))] = $option_id;
$option_id = substr($option_id, strlen(UPLOAD_PREFIX));
Re: Product Attribute Grid
Quote:
Originally Posted by
mc12345678
In a way, glad that there's only one logged issue. That issue (assuming that the attribute isn't a file type attribute) wouldn't be expected to be related to the problem of the attribute missing from the cart.
That said, I haven't tested/updated grid attributes for the more recent Zen Cart version(s). But can look at that possibly later today.
There *is* the possibility that the download of SBA may need to be updated because I did briefly have some changes in place for download that supported only evaluating the quantity of available product in a certain way which was non-conformant with how some other plugins were written to interface with SBA.
In the mean time can you gather some data for me?
1. Does the same non-add to cart occur to a product that is setup with the same attributes but not tracked by SBA?
2. What version of Zen Cart?
3. What php version does the cart see?
4. On what date was the SBA package downloaded?
5. What types of attributes make up this product? (one of course is the grid attribute)
Thanks for getting back to me. Have just seen the posts below, but thought I would get the information you asked for before trying out the suggestions.
1. Product adds to cart with same attributes when not tracked by SBA.
2. Latest release of Zen Cart - 1.5.7c - 14-03-2021
3. PHP V7.2.34
4. SBA downloaded from Git repository on 11-03-2021. Just checked the repository and noticed a number of updates from 2 days ago.
5. Attributes are colour and size. There is no pricing by attribute.
Really appreciate the help.