Zen Follower
- Join Date:
- Mar 2011
- Location:
- Ireland
- Posts:
- 286
- Plugin Contributions:
- 0
Product Attribute Grid
scrap that, god I am stupid at the mo. the settings were turned off in admin config:lookaroun
Site maintenance: Tuesday 17 Nov, from 10:00 UTC, about 4–6 hours. Details
This cutover relies on some testing that is still incomplete so may be cancelled at short notice
Zen Follower
scrap that, god I am stupid at the mo. the settings were turned off in admin config:lookaroun
Totally Zenned
jagall:
scrap that, god I am stupid at the mo. the settings were turned off in admin config:lookaroun
Happens. Yes, configuration->attribute settings->enable price factor would need to be true.
I did forget to also indicate that the product price would need to be set to 0 when establishing the product as priced-by-attribute.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Zen Follower
Totally Zenned
jagall:
thank you, thank you so much, working perfectly
Including the one "product" that had like an extra €1 cost?
Well, I asked/wrote that, before I went to test it... not quite setup correctly and also not using this plugin.
Check boxes were used for each of the items, and I was able to select just two of the check boxes and add to the cart. Would be charged only €20 and had no notification about a need to add more... Also, all of the options were the same price, where before, one of them was slightly higher...
To explain for other readers what has been seen, is that the units are set to 0.2, and the maximum is set at 1. Then, when returning to the product, if I attempted to select three options "separately" and add to the cart, I was denied because it looks like the minimum quantity has been entered as 1 (which also made the add-to-cart button not include a quantity.) therefore, the only way to "correct" my mistake would be to remove the product from the cart and try again.
Conversely, when I deleted the product from my cart, went back to the product, I was able to select all 8 options and add it to the cart. (checkboxes work that way as they tend not to be directly associated with an "option" but more of a state... On or off, not this one versus that one.) this also makes the concept of the €50 group incorrect and more like a €10 each item, as few or as many of the selections as you would like...
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Zen Follower
mc12345678:
Conversely, when I deleted the product from my cart, went back to the product, I was able to select all 8 options and add it to the cart. (checkboxes work that way as they tend not to be directly associated with an "option" but more of a state... On or off, not this one versus that one.) this also makes the concept of the €50 group incorrect and more like a €10 each item, as few or as many of the selections as you would like...
thank you mc12345678 for doing more testing that I did anyway. See what you mean now, that's a pity thought it was cracked, I suppose I am relying on the customer's attention to detail here. I assume radio buttons, etc all work the same way. It's going to have to do, its nearly the finished spec, don't suppose you have any other suggestions? on how to get around it?
thanks so much for getting me this far:D
Totally Zenned
jagall:
thank you mc12345678 for doing more testing that I did anyway. See what you mean now, that's a pity thought it was cracked, I suppose I am relying on the customer's attention to detail here. I assume radio buttons, etc all work the same way. It's going to have to do, its nearly the finished spec, don't suppose you have any other suggestions? on how to get around it?
thanks so much for getting me this far:D
Well, the writeup I provided on the previous page identified a method to accomplish a one time purchase (or if desired multiple occurrences of the "package") with it simplified to the following:
This plugin installed.
Product price: 0
Product priced by attributes.
Qty min/qty units: true
Units set to 5 (allows purchase of multiple packages if maximum is not used and when viewing the cart, the customer is notified of the need to include more options or remove excess to get to the unit quantity of 5)
Maximum set to 5 to limit to a one time purchase otherwise 0 will allow unlimited "groups" of this product.
Attributes:
For purchase of 5 items where each is to be €10:
Attribute price €50 (remove the +), price factor of 0.2, with an offset of 1.
This option name being assigned as a PAG style option.
Otherwise, there may be an entirely different method that instead offers options as a bundle instead of trying to use attributes to provide groupings.
But the above will support stock tracking by Stock By Attributes with the attributes each tracked individually rather than as some sort of "group", and an out-of-stock condition should be displayed for whichever is no longer available.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Zen Follower
mc12345678:
Well, the writeup I provided on the previous page identified a method to accomplish a one time purchase (or if desired multiple occurrences of the "package") with it simplified to the following:
This plugin installed.
Product price: 0 OKAY
Product priced by attributes. OKAY
Qty min/qty units: true HAVE THIS SET TO 0.2Units set to 5 (allows purchase of multiple packages if maximum is not used and when viewing the cart, the customer is notified of the need to include more options or remove excess to get to the unit quantity of 5)
I am confused re the max/min qty, when I put max and min of 5 into the product quantities it would multiply the quantities by 5 so getting total of €250 in cart. I have currently mix qty units set to 0.2 and the max /min set to 1.
Maximum set to 5 to limit to a one time purchase otherwise 0 will allow unlimited "groups" of this product. IS THIS IN ATTRIBUTES ONLY
Attributes:
For purchase of 5 items where each is to be €10:
Attribute price €50 (remove the +), price factor of 0.2, with an offset of 1.having tried taking the + sign out.
This option name being assigned as a PAG style option. what is option name being assigned as a PAG style ? don't think come across this before
Otherwise, there may be an entirely different method that instead offers options as a bundle instead of trying to use attributes to provide groupings.
But the above will support stock tracking by Stock By Attributes with the attributes each tracked individually rather than as some sort of "group", and an out-of-stock condition should be displayed for whichever is no longer available. ..................
Totally Zenned
jagall:
..................
So a little further explanation as forcing the minimum to 5 IS going to cause a problem like you saw.
But before that, The PAG style option was meant to refer to the selection(s) in the option name manager for an option name that it should be set to Grid (which it was yesterday) instead of dropdown, radio, checkbox, etc... That is how this particular plugin presents itself during operation.
When there is an attribute or an attribute combination (ie. multiple option names), each selection within the screen makes up a "product". This plugin allows having multiple such different options on screen at once and to allow the user to add the desired individual quantity of each attribute choice.
Ie. imagine if the option name was color and there were three colors. In a normal dropdown, you can select one color (and associated quantity), you add the product to the cart and if you want an object of a different color, you have to again select the color and then the quantity for that particular color. So if you were to require a minimum of 5, then whenever you chose the first color and added to the cart, you would be required to have a minimum of 5 of that color... That's not how this particular product is to be setup... Therefore, you want to allow a single instance of one of your attributes (an object instead of a color), but you want to prevent more than 5 from being added to the cart. Also, you want to be sure that 5 will be added to the cart (to permit purchase) which is the unit. The Product Qty Min/Unit Mix option indicates (though discussed more in depth in the applicable FAQs) that, regarding units and minimum quantity (though maximum is also affected), it is acceptable to mix and match attribute options to meet those requirements such that, if a maximum of 5 is set, you can choose a quantity from any of the attributes and add it to the cart so long as the total number of choices is 5 or less. If that value was set to false, then you would be permitted to choose up to 5 of each attribute type and all 8 options could be used for a total of 40 product.
But, if you were to require a minimum of 5 and because each attribute with your base product is itself a product, then every addition of an attribute style product would require a minimum of 5 of those to be added... Also not exactly what you want (because you want to allow the customer to choose different items to make up the total of 5 items and the total price).
So... I neglected to say, set (or normally leave) the minimum at 1. I also didn't say anything about taxes, shipping setup, etc...
And I incorrectly referred to the Product Qty Min/Unit Mix as a true/false condition when the admin screen shows radio buttons for Yes and No... So that should be set to Yes (true).
So, top-down for a standard product info page:
This plugin installed.
Product priced by attributes.
Product price: 0
Product Qty Minimum: 1
Product Qty Maximum: 0 (if allowing multiple purchase of this group in this order) or 5 (if only allowing purchase of this group one time in this order)
Product Qty Units: 5
Product Qty Min/Units Mix: Yes
Attributes:
For purchase of 5 items where each is to be €10:
Attribute price €50 (remove the + from the box to the left of the numeric price), price factor: 0.2, (price factor) offset: 1.0
From Catalog->Option Names, navigate to the option name for these selections (Option Name: €50 Party Deal, Option Name ID: 57), edit the option name, select the option name type of Grid, select the Update button as the option name previously existed.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Totally Zenned
Just now checked the product again... Because units are set to 0.2 (instead of 5), I can add less than 5 items (tried 1 of one type and 2 of another) and select checkout and receive no notification that I need to add more options to make up my 5 items. I did try to add a fractional quantity such as 1.2 (expecting minimum to be 1 and because the units are set to 0.2, would expect to be able to add product in quantity of 0.2); however, there is yet another setting in the ZC admin regarding product quantity decimals (Configuration->Stock->Product Quantity Decimals) that defaults to 0 meaning no partials are allowed. This condition could be seen within the shopping_cart page by attempting to adjust the quantity of 2 to 1.4 and was advised that it was rounded down to 1. What that further means is that really the units setting currently serves no purpose other than to possibly confuse customers...
Also, I'm surprised that your "shopping cart" button only displays the product name and does not include the associated attributes (mobile view anyways) which a product with attributes makes the display of that information not very useful.
Also, if you don't want to display the bottom line quantity box, you should be able to disable it for the product by changing Products Quantity Box Shows to No, Do not show Quantity Box, but this also has an effect on the shopping cart page unfortunately to where the quantity there can not be modified once added... Guess that's something to look into for this plugin other than through CSS on each product page or additional template code change to support display of a single add-to-cart button when it is desired to only add a single "grouping" from the product page and the ability to modify the quantity on the shopping cart page as a result...
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Zen Follower
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.
Totally Zenned
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.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Totally Zenned
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/Attributes-Grid/commit/7b22f7d4e2eef79747ec7ae0fa61d243c621ef0c
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/Attributes-Grid/tree/mc12345678-disable-qty-box
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Totally Zenned
Has this mod been tested with 1.5.6# and 1.5.7?
Asking for a friend:P
Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com
Totally Zenned
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"...
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
New Zenner
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
New Zenner
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.
Totally Zenned
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?
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
zennedOut
@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.
//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));
*/
Totally Zenned
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.
//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:
} 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));
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
New Zenner
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?
- Does the same non-add to cart occur to a product that is setup with the same attributes but not tracked by SBA?
- What version of Zen Cart?
- What php version does the cart see?
- On what date was the SBA package downloaded?
- 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.
Really appreciate the help.
Tell staff why this post should be reviewed.