Re: Editing cart contents -- esp products with attributes
Thanks for all your feedback, Possum, Kuroi, and of course Moderator :smile:
I had a look at the buy now -> shopping cart vs buy now -> product info issue.
It does not have any thing to do with the Edit Cart mod. If you add a product with no attributes to your catalog, then hit the buy now button, I am pretty sure it will take you to the cart.
When a product has attributes, even clicking a buy now button, you get taken to the product info page. It seems to be by design, even when the product is not priced by attributes.
I had a little look at what it might be, but couldn't see it. I can only tell you where I would start to look. You should look at includes/main_cart_actions.php to find the name of the action that your buy now button is calling, and you should see there the corresponding function of the classes/shopping_cart.php that is being called. Then if you step through the logic in that class, my guess is that it will have some kind of check if the attributes have been set or not.
But it could be that if the product has attributes, it needs to have values for each attribute passed in when adding to cart. Because subsequent logic matches DB/product/attributes with Cart/Products/attribute_values.
Hopefully somebody more knowledgable will spot this post:huh:
Justin
Re: Editing cart contents -- esp products with attributes
Quote:
Originally Posted by
possum
I do not have any mandatory attributes, so I'd like to be able to allow customers to add the product to their cart directly from the product listing without going via the info page.
This is unrelated to the Edit Cart mod, insomuch as the two sets of functionality are separate issues. It probably warrants a dedicated thread ... perhaps it should be resurrected in your other thread related to editing cart contents.
Granted, your point that the Edit Cart mod is useful to fine-tune things after-the-fact is noted.
If you want to add attribute-connected products from the product-listing page, you'll need to change the way the product-listing page adds products to the cart. You'll need to add the extra input fields for attributes into the product-listing page so that they can be selected from there. This means you'll need to turn the single-form-page into a multiple-form-page ... which changes the page layout logic significantly ... almost completely.
You said that none of *your* products require the selection of any attributes. I suspect that the number of sites using entirely optional attributes in all cases would be slim. Justin's right that to do this you'd have to alter the shopping_cart class to break its safeties around adding products to cart without any attributes being selected when attributes are assigned to the product. There may be dangerous caveats to that ... caveats which could be different for each type of attribute that could be assigned.
Re: Editing cart contents -- esp products with attributes
That being said, I think you will need to go in a different direction to achieve your aim, Possum.
I wonder if "Gift Wrapping" couldn't be a separate product? I don't know what you are selling, but what if someone buys 2 or three different items? Then selecting a gift wrapping attribute for each of them might be nonsensical anyway.
Well if you really want to do it, I would change the code for the buy now button on the product listing page. How about changing it such that it submits the same information as the add_product action of the cart_quantity form on the product info page? You would need to hard code hidden parameters for the quantity, gift wrapping attribute at least, into the buy now button code.
Good luck
Justin
Re: Editing cart contents -- esp products with attributes
I think Justin is hitting the nail on head. In my experience when people start talking about optional attributes, often what they are talking about turn out to not be attributes of the products themselves, but separate products or services that are added to the base product. I see this particularly in the situation where people are struggling to work out appropriate stock levels by attribute for additional services such as installation or gift wrapping where it becomes very clear that the stock is in no way related to that of the product to which the service is being applied.
Under these circumstances there are a range of add-ons that can be usefully applied such as cross-sell, better together and the more specific gift wrapping mods.
In the other case that possum has quoted elsewhere, name, attribute heavy products such as computer configurations, it seems likely that most if not all the attributes would be mandatory, even if to opt not to include them in the specific configuration being built. Under these circumstances, I would really heed Dr Byte's advice. Breaking the validation built into the cart on the basis that a customer can go back from the shopping cart to actually select preferred attributes would be a recipe for disaster.
Re: Editing cart contents -- esp products with attributes
Hi Justin,
Thanks for the great mod! I think it should be integrated into the core code at some point.
Could you tell me how you added the [click to edit] to the item name field in the cart? Does this come up for every product, with or without attributes? If so, can you modify it so that it only shows on those listings that have attributes that someone might want to go back and change?
Thanks!!
Matt
Re: Editing cart contents -- esp products with attributes
** changed mind - post deleted **
Re: Editing cart contents -- esp products with attributes
Hi lankeeyankee
Quote:
Originally Posted by
lankeeyankee
Could you tell me how you added the [click to edit] to the item name field in the cart? Does this come up for every product, with or without attributes? If so, can you modify it so that it only shows on those listings that have attributes that someone might want to go back and change?
Yes that is a good idea. Actually I have not changed the shopping cart at all in the mod. On my own site, I added the text [click to edit] but it is just text, there is no logic.
Code:
<a href="<?php echo $product['linkProductsName']; ?>"><div id="cartImage" class="back"><?php echo $product['productsImage']; ?></div><div id="cartProdTitle"><?php echo $product['productsName'] . '<br />[click to edit] <span class="alert bold">' . $product['flagStockCheck'] . '</span>'; ?></div></a>
But there is not much need to edit a product with no options, it is true. And at present the edit product page does not even have a quantity field that the user can edit.
Adding the logic to the shopping cart/product_info page to distinguish between cart items with attributes and those without is not such a big job. But I won't be able to do it for a wee while (a week or two). But that will be next change I make. Unless you feel like doing it :D
Justin
Re: Editing cart contents -- esp products with attributes
Hey - great mod. I have a shop which allows/requires customers to enter personal text for their item. Often they may spot a typo at the last minute.
I noticed that with "Return to cart" turned off, after the client has edited the attributes, they come back to the product for more editing, but the attribute fields don't repopulate. Anybody else noticed this?
Could you redirect the "update product" button to point back to the shopping cart in this instance?
Re: Editing cart contents -- esp products with attributes
Hey solarflare
Off the top of my head, forcing the update product button to override the "Return to Cart setting" and go off to the shipping cart, sounds a bit tricky.
I won't be able to look at it though, for a few days. But I will look at it and report back. It would certainly be better if the attribute settings properly reloaded.
Justin
Re: Editing cart contents -- esp products with attributes
I installed the Edit Cart mod. I used WinMerge and simply added the "Edit Cart Mod" block to my tpl_product_info_display.php file because it was heavily modded to Tabbed Product Display. I noted that the "[click to edit] button did NOT appear under the product name as it does on Justin's site and when I clicked on the product image or name, I got a "Forbidden Access" error message rather than returning to the product page. I verified that this happened on my backup copy without the Edit Cart mod so obviously I had done something in a previous mod or it was a result of upgrading from 1.37 to 1.38a. :oops:
Does anyone have an idea where I should look for the problem?