Ben224 Posted December 20, 2012 Posted December 20, 2012 Hello, I have added a gift wrapping option to some products. I have achieved this by adding a product option which displays a drop down menu on the product page with the option of choosing gift wrapping for a small additional cost. It works fine. But... If the visitor does not select the gift wrapping option in the drop down menu CC displays a warning message i.e. ... please select the required option before adding to your basket! I would expect this for a 'Required' option but the trouble is that this particular option is 'not required' and the user should be able to ignore and check out without getting the warning message. It goes without saying that I have unchecked or disabled the required feature from within the 'option groups' tab in dashboard. Frustrating because customers cant figure out what the warning message is for and is leading to a loss of sales. I want to keep the option if possible. Any help appreciated many thanks in advance! Quote
Dirty Butter Posted December 20, 2012 Posted December 20, 2012 As a work- around until someone suggests a solution - could you create a NO GIFT WRAP option as well with zero cost? It seems like that would stop the warning. Quote
Ben224 Posted December 20, 2012 Author Posted December 20, 2012 Hi there, Thanks for the response. Yes this would be a good work around as you point out and one that I had considered initially, but I have this particular option spread over a couple of hundred product pages and I couldn't figure a way of adding an additional attribute to this product option globally. Which makes me think my only option is to go through hundreds of products and add the NO GIFT WRAP manually which naturally I was hoping to avoid if possible. Appreciate your thoughts. Quote
Dirty Butter Posted December 20, 2012 Posted December 20, 2012 There should be a way to do it with a Query - not that I would know how. But just in case you know how - add the No Gift Wrap Option to one item and see how it shows up in the option_assign table. Then maybe there would be a way to search for just the ones WITH the Gift Wrap Option and Add the No Wrap Option. Since obviously I don't know what I'm doing - why not ask on the 3rd party forum, too. Maybe someone there could provide you with a simple way to accomplish this in bulk. Quote
bsmither Posted December 21, 2012 Posted December 21, 2012 I'm still working my way through the code, but I haven't found any kind of smoke that would indicate there may be a smoking gun, so to say. If you return to the Option Groups page, for that Option Group "Gift Wrapping", does it still indicate a red-X in the Required column? There have been some issues with certain versions of CC5 not being able to record a zero in the database. Also, from your description, it seems the problem manifests from the Add to Cart button on the Product Description page. Since there are no options selectors on the View Category page where this product is listed, nor in the Latest Products section of the Homepage, does clicking Add to Basket from these pages successfully add the product to the basket, or is the customer bounced to the Product Description page with the error message, "Please select required options before adding to your basket." Quote
Ben224 Posted December 21, 2012 Author Posted December 21, 2012 Hi thanks for your response, Following your reply I have done a little more investigation into this issue. The red-X is still indicated on the options group page. The last scenario you have outlined above is indeed correct, allow me to detail. The issue only appears to occur when the user selects 'add to cart' directly from the view category page. In other words when 'add to cart' is clicked from the category view page the product page is loaded with the error message. If the user clicks 'add to cart' directly from within the product page they are free to check out without an error message. Its worth mentioning that I have my settings defined to take the user directly to the shopping basket page on 'add to basket'. I hope this is helpful? Quote
bsmither Posted December 21, 2012 Posted December 21, 2012 Well, I don't completely understand Devellion's thinking on this, but here's my guess: If a customer clicks Add to Basket, a determination needs to be made: from where did the customer click? (As of CC515) The choices are: Latest Products (LP), View Category (VC) (includes Search Results and Sale Items), and View Product (VP). (There is also updating the basket contents when checking out, but that is not discussed here.) From VP, the form sends back the add product id, quantity, and an array of productOptions (including empty values). From LP, the form sends back the product id as the value to the form variable add. From VC, the form sends back an array-construct named add that includes the product id as key-1, the word 'quantity' as key-2, and the quantity as the value. A test is made for the absence of the productOptions array, and if missing, will then perform two more tests. Each test attempts to determine if the form submission came from VC or LP depending on the nature of the add form variable. One tests for an array-type variable (as from VC), the other tests for an integer value (as from LP). Here are the problems. 1. From VC, the actions taken if the test is true (this is an array) will then perform another test -- are there any options for this product. If so, and not being concerned if these options are required or not, will always bounce the customer to VP. This is either an actual programming error, or a mistake with some philosophical point. The programming error is that the test for any options should be a test for any required options for this product. The philosophical point is that, if a product has options the customer may not know about and may actually want if presented with these options, the customer will get bounced to VP and that this is not an error but should be a notice that options exist. (Which begs the question, why Buy when the actual result suggests the button should be labeled More for products with options.) 2. From LP, the test to determine the nature of the variable uses the wrong PHP function. It is testing if the value of add is an integer. All browsers send POST values as presumed strings, and PHP interprets all POST values as such. Thus, this test will always fail and the customer is never bounced to VP (and further processing will catch the case if required options need attention). The test needs to use the PHP function that tests if the value of add looks like an integer, not if it actually is an integer. But if this were to be fixed, then the philosophical point above holds true for this test as well. Any fix needs to answer this question first: Do you want the customer to be presented with the options, even if not required, when selecting products from LP or VC? Quote
bsmither Posted December 21, 2012 Posted December 21, 2012 If the answer to the above is Yes, then: * Add a new string to the language file saying "Please note that there are options available for this product." * Change setError() to setNotify() at two places * Fix if(is_int($_POST['add'])) { to simply else {. * Possibly change Buy buttons to More buttons as appropriate. If No, then: * Add a test for getOptionRequired() at two places * Fix if(is_int($_POST['add'])) { to simply else {. Quote
Ben224 Posted December 21, 2012 Author Posted December 21, 2012 Hi and thanks, I appreciate the clarity you bring to these bugs on the forum, glad you're here! I think in all instances if a product has options the customer should be made aware of them. So irrespective of the source, if a customer hits a buy button it most certainly should initiate a redirect to the appropriate VP page to display the associated options for that product. Absolutely essential in my opinion. I agree there is a philosophical point and I speak for myself here but I can live with the 'Buy' label only. I don't need the 'More' label - if there is more to see after the customer hits 'Buy' then fine the redirect is a pretty self explanatory action in that case. Picking up on your suggestion above. From my perspective what is needed here is for CC to display a notice that options do exist on redirect and not to display a big bad sign telling them they did something wrong by choosing to 'Buy' from the VC page. However if the customer ignores required options once on a VP page an error notification is appropriate. Appreciate your thoughts. Thanks again. Quote
bsmither Posted December 21, 2012 Posted December 21, 2012 On the philosophical point, I could go either way. I can see where making sure the customer is aware of options, required or not, would be desirable. But then, in that case, I would make all options required and each option would have a "No thanks!" as a value. I can also see where optional options are just that, and is of no consequence to me and, I assume, the customer. Here is what we are going to do: * Add a new string to the language file saying "Please note that there are options available for this product." * Change setError() to setNotify() at two places * Fix if(is_int($_POST['add'])) { to simply else {. In the file /language/definitions.xml, at about line 316, we will add a new string and place it in alphabetical order with the surrounding strings. <string name="notify_options_exist" introduced="5.0.0"><![CDATA[Please note that there are options available for this product.]]></string> In the file /classes/cart.class.php, at about line 128 and line 141: REPLACE $GLOBALS['gui']->setError($GLOBALS['language']->catalogue['error_option_required']); WITH $GLOBALS['gui']->setNotify($GLOBALS['language']->catalogue['notify_options_exist']); Also in this file, at about line 138: REPLACE } if(is_int($_POST['add'])) { WITH } else { Also in this file, at about line 127: CHANGE if($GLOBALS['catalogue']->getProductOptions($key)) { TO if($GLOBALS['catalogue']->getProductOptions((int)$key)) { Quote
Ben224 Posted December 21, 2012 Author Posted December 21, 2012 Hey, Great thank you I was scratching my head a little with the last set of instructions but this is better. Referring back to the philosophical point. I look at it purely from a retailers point of view. Making all options required even if they are not means creating another button to be dealt with by the customer before completing the sale. However petty that may sound it does make a difference. Getting customers out and through the payment gateway as quickly as possible is a priority. Thanks again. Quote
Ben224 Posted December 21, 2012 Author Posted December 21, 2012 Implemented the changes. Works perfectly! Thank you. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.