-
Editing cart contents -- esp products with attributes
On our site, all of our products have a great many attributes. It is common for a customer to set some options and add to their cart but then want to edit those options later on.
However currently doing so, does not edit the existing products attributes in the cart, but adds another product to the cart. Needless to say, this is not what most customers consider intuitive.
Is there a setting I can change to allow users to edit the cart contents? Or do I need to make coding changes to achieve this? Thanks
Justin
http://www.kuroobiya.com
-
Re: Editing cart contents
It's a good idea, but would require custom coding.
-
Re: Editing cart contents
Bummer. But I wondered if that were the case. I have no option really but to do make those changes. I figured I would add some logic to the add to the cart processing to delete the existing item, and then add it again with the new option settings.
Does that sound like the right approach?
-
Re: Editing cart contents
Not really. The cart exists behind the scenes as a multi-dimensional session array. Rather than trying to remove parts of it, it would be more straightforward simply to update those specific values that have been changed.
Just to warn though, you're heading into some reasonably complex code.
-
Re: Editing cart contents
Hmmm. Well I will give it a bash and post back here with how it all goes.:blush:
-
Re: Editing cart contents
OK. I did it and it was not so tricky in the end.
You can get it from the Zen Cart downloads page. It is called Edit Cart.
And you can see it in action at kuroobiya.com
-
Re: Editing cart contents -- esp products with attributes
Nice job. Not what I had envisaged, which was the ability to change an attribute without leaving the shopping cart, but in your case where the attributes are many and really need the support of the additional information on the product_info page, an appropriate and elegant way of achieving the objective. Good solution. Thanks for sharing.
-
Re: Editing cart contents -- esp products with attributes
And it seems that somebody else wanted this to work exactly as you've designed it!
-
Re: Editing cart contents -- esp products with attributes
Hi,
I'm the "someone else" that kuroi mentioned. Love the mod ... you've saved me from a lot of hassle trying to do this myself!
I found a small problem with the distribution zip file. The "edit_cart_button_names.php" file should be in /languages/english/extra_definitions/TEMPLATE_NAME, not /languages/english/TEMPLATE_NAME/extra_definitions.
Thanks again. I hope others find it as useful as I do.
Possum.
MODERATOR NOTE: distribution zip file has been updated.
-
Re: Editing cart contents -- esp products with attributes
Hi,
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. With the new Edit Card mod, they can then go back and add the attributes (gift wrapping in my case) when they want to.
I guess nobody has tried to do this before because without the Edit Cart mod it doesn't make sense.
I went to the /includes/modules/MY_TEMPLATE/product_listing.php and commented out the "if" logic that puts up the "more info" message for products with attributes. That worked well and the resulting "buy now" button does indeed point to the "buy now" action.
Strangely, however, clicking on that link does not go to the checkout but instead takes me to the product info page to configure the product. This is strange because, as I mentioned, the attributes are not required, and the link was supposed to take me to the checkout.
Any thoughts gratefully received.
Thanks
Possum.
-
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?
-
Re: Editing cart contents -- esp products with attributes
Quick update: Tested problem on unmodded 1.38a version and return to product display from cart worked fine so it was NOT the upgrade from 1.37 to 1.38a that caused the problem
-
Re: Editing cart contents -- Forbidden Access
Disregard my last message. The 1.38a version without the Edit Cart mod did NOT work.
This problem gets wierder!
I reread the forum and fixed the missing "[click to edit]".
I am using a local WAMP server running Apache 2.0.58, PHP 5.14 and MySQL 5.0.22. I have several copies of the shop installed for testing, each with its own database. There is a copy of the shop on the remote server behind a firewall.
On the remote server running ZC 1.38a, clicking on the product image/name in the shopping cart returns you to the product listing as expected. On the local server an old copy of the shop running ZC 1.37 does the same. The copies of the shop running ZC 1.38a on the local server give the Forbidden Access error message. ALL of the ZC 1.38a versions are running Ultimate SEO mod along with some others.
I copied the working copy of the shop from the remote server to a new folder on the local server, adjusted the config.php and the .htaccess files, imported the SQL database from the remote to a new db on the local server and ran fix_cache_key.php. Forbidden Access from the cart. :frusty:
HELP!
-
Re: Editing cart contents -- Forbidden Access problem
For all PRACTICAL purposes, the problem is "fixed".
I bit the bullet and installed the Edit Cart mod directly to the remote server.
It works perfectly. So the problem is "fixed" but NOT "solved". :blush:
If anyone has any ideas as to why the WAMP server is misbehaving, I would appreciate them.
-
Re: Editing cart contents -- esp products with attributes
I am glad you "got out of the hole" at least on your production server.
Just to reiterate, the "[click to edit options]" is just text I added to my, also heavily modded, shopping cart page. It is not actually necessary to add that. A click on the product name will take you back to edit the options regardless. I only added that to labor the point for users of my site. But I did not think it was worth making "edit cart" users change their tpl_shopping_cart page.
I have been very busy and have not had a chance to update the mod for ages. But there are a few tweaks that people have requested, so will try to do do soon.
As for your other error. It is very mysterious. Anything in your logs?
-
Re: Editing cart contents -- Forbidden Access error
NO, nothing in the logs on the WAMP server.
I noted that the problem with the link was what I presumed was a session number attached to the end of the URL for return to the product page.
For example, the product page for the product which was added to the cart was localhost/newzen/embark-p-546.html but the link was trying to load
localhost/newzen/embark-p-546:b77b08f707992a5d739bd25dcf2d0d77.html.
I noted that tpl_shopping_cart_default.php uses $product['linkProductsName'] for the link from the product name and this produces the extended URL whereas the "Continue Shopping" button further down uses zen_back_link() which takes me back to the product page. Of course that only works if I want to edit the product immediately after I've added it. And the problem occurs even when the Edit Cart mod to tpl_product_info_display.php is NOT installed. So clearly it is NOT a problem with Edit Cart.
I just can't figure why it works on the remote server and NOT on the local WAMP server. Unless the problem was never tested before and the differences in the server configurations are the problem:
Remote server (GoDadddy): ZC: 1.38a Apache: 1.3.33 PHP: 4.3.11 MySQL: 5.0.45
Local WAMP server: ZC: 1.38a Apache: 2.0.58 PHP 5.1.4 MySQL: 5.0.22
I appreciate your mod and interest.
Let me know if you have any further thoughts.
-
Re: Forbidden Access error
Justin,
One last piece of information. Turning OFF the Ultimate SEO mod allows the shopping cart link to function properly on the WAMP server. (But it works OK with the SEO mod ON on the GoDaddy server)
Looks like I will have to search in that thread and if I don't find something I'll post the problem there. :blink:
-
Re: Editing cart contents -- esp products with attributes
Ah, well spotted. ... and good luck.
Justin
-
Re: Editing cart contents -- esp products with attributes
I have no idea why this is not working for me.... seems so straight forward.
I used FTP to upload the includes folder to my root folder exactly as instructed. I made on changes whatsoever. Did I miss something? My products will have a LOT of attributes so I believe this is an important mod.
Any advice is appreciated.
Zen Cart v1.3.8
-
Re: Editing cart contents -- esp products with attributes
Hi MtnVision
Did you change the all folders named TEMPLATE_NAME to your actual template name ("SophyBlue" ) before you uploaded all the files?
That would be the most obvious thing to check. The mod does not have very many files, so I would check, one by one, that they have all been uploaded, and that they are in the right places.
Justin
-
Re: Editing cart contents -- esp products with attributes
Yes I did make the MY_TEMPLATE folder name changes. I'm sorry about that comment but I meant code changes. Yes I have reviewed the directory structure & made an observation that the template I use SophyBlue is not 'sophyblue' in lower case so that correction was made.
But still no worky. :unsure:
-
Re: Editing cart contents -- esp products with attributes
OK. I went back and had another look at your site. If the item in the cart does not have any attributes then the edit cart mod won't see an item to be edited. It will see it as item being added as new. (If you consider it a little, thats right, because there is nothing to edit but the item quantity, which can be done in the cart itself.)
I could not find an item with attributes on the site. Are you testing items with attrubutes? If not, please create one and retest. If you are, please tell me which item I should be testing with.
Justin
-
Re: Editing cart contents -- esp products with attributes
I have encountered an interesting "problem" whereby I have attributes set for some of our products and on each list I have a "Select your colour" set as a default non selectable. If the user inadvertently chooses this and clicks update, the correct response is displayed saying "Please correct the following: On the Option for: Colour You picked an Invalid Selection: Select required Colour"
If the users then corrects the mistake by choosing a colour and clicking update the cart is emptied and takes the user back to the products page.
I am not too concerned about this personally, but it may to someone else.
Zen 1.3.8a
-
Re: Editing cart contents -- esp products with attributes
Zen Cart isn't designed to empty the cart but to keep you on the product _info page when adding a product with attributes where default and display only is used ...
If you are getting this odd behavior, it sounds like one or more files is not up to date ...
-
Re: Editing cart contents -- esp products with attributes
Quote:
Originally Posted by
Ajeh
Zen Cart isn't designed to empty the cart but to keep you on the product _info page when adding a product with attributes where default and display only is used ...
If you are getting this odd behavior, it sounds like one or more files is not up to date ...
Hi Ajeh
I agree entirely, it is very strange. I have the latest 1.3.8a fileset and what I believe to be the latest Edit cart mod. The site is not live yet but you are more than welcome to try it out for yourself.
http://d52803.u29.jswebconsole.co.uk/index.php
-
Re: Editing cart contents -- esp products with attributes
Agamic,
I just looked at your website and the Edit Cart seemed to function correctly.
I selected a plain tarp with no color choice and was able to add it to the cart and then edit it (different size).
Then I selected the "striped tarps", selected the size and did NOT select the color. I got the expected error message and REMAINED ON THE PRODUCT PAGE. I selected the color and it went to the cart as expected. Then I was able to edit BOTH the size and the color without problem.
Looks like you got it solved. :clap:
-
Re: Editing cart contents -- esp products with attributes
Quote:
Originally Posted by
mauryg
Agamic,
I just looked at your website and the Edit Cart seemed to function correctly.
I selected a plain tarp with no color choice and was able to add it to the cart and then edit it (different size).
Then I selected the "striped tarps", selected the size and did NOT select the color. I got the expected error message and REMAINED ON THE PRODUCT PAGE. I selected the color and it went to the cart as expected. Then I was able to edit BOTH the size and the color without problem.
Looks like you got it solved. :clap:
Hi thanks for testing. When you went back to edit the item did you select "Select required colour" and then click update, which is when the warning comes up saying you have not selected a colour, then go back and select a colour and click update and it is at that point the cart empties.
So to recap:
1/ Select a striped tarp choosing size and colour and add to cart.
2/ From the cart click on the stripe tarp item
3/ In colour or size choose the default which is select colour or select size and click update
4/ At this point you should have the warning about incorrect option.
5/ Go to the option that has the "select colour or size" and change it to something and click update.
6/ pooof - cart is empty and you are back to the shopping cart is empty page.
By the way this happens with all attributed products not just stripe tarps.
-
Re: Editing cart contents -- esp products with attributes
Actually I just tried and was able to verify it. I know why it occurs too.
When the user clicks Update Cart on the product page, the edit cart mod detects whether an item is being added to the cart / or edited. If it is being edited, it deletes the existing product, and then goes through the default "Add Product to Cart " process. Since an error occurs after the product has already been deleted, and before it has been added, the cart is emptied. Doooh.
I am sure I can work around it, but I am just very busy and do not know when I can get onto it. How soon till your shop goes live Agamic?
-
Re: Editing cart contents -- esp products with attributes
Quote:
Originally Posted by
justinhunt
Actually I just tried and was able to verify it. I know why it occurs too.
When the user clicks Update Cart on the product page, the edit cart mod detects whether an item is being added to the cart / or edited. If it is being edited, it deletes the existing product, and then goes through the default "Add Product to Cart " process. Since an error occurs after the product has already been deleted, and before it has been added, the cart is emptied. Doooh.
I am sure I can work around it, but I am just very busy and do not know when I can get onto it. How soon till your shop goes live Agamic?
Hi Justinhunt
Thanks for the quick response. I appreciate your efforts to fix the problem. The shop is due in a few weeks but to be honest I can live with this until you have time. I can't see a customer going through this cycle too often if ever.
Again many thanks
-
Re: Editing cart contents -- esp products with attributes
Justin, added the EDIT ORDERS to my site. Great feature by the way. When I click on the [click here to edit] it returns to the product_info page. However, it doesn't go into the edit mode.
I've tried to debug by putting an ECHO statement within that first IF statement that was added with your contrib. The button doesn't switch at the bottom to the UPDATE still shows ADD TO CART button.
Got any ideas what might be happening?
www.austincotton.com
-
Re: Editing cart contents -- esp products with attributes
You do not appear to have added attributes to your products yet.
Add some atttibutes to a product, then pretend you are a shopper and add that product to your cart. After that you should be able to edit that products options, by clicking on it in the cart.
Justin
-
Re: Editing cart contents -- esp products with attributes
Justin, try product number 1024 enter that into the search box. Only wanted to try one product at first for testing purposes before I ported it over to all the other products.
Then you will see what I'm talking about.....after you click on the [click to edit] in the shopping cart. The product_info page doesn't go into the EDIT mode.
-
Re: Editing cart contents -- esp products with attributes
OK, yes I see it now. There is certainly no shortage of options on that product.
Well the problem is, as you noted, because it is not drawing the right button on the form. This can only be because this expression
Code:
if (! is_numeric($_GET['products_id'])){
Is evaluating false (ie the products_id appears to be numeric.) When the cart is being edited, the products_id paramater in the product_info page , looks like this:
products_id=181:c9f79d635f23d0c699f806417aec2f6c
Which is not numeric.
When a product is being added, it looks like this:
products_id=181
Whichis numeric
Have a look over your tpl_product_info_display.php and see if the code there matches what is in the edit_cart mod. If you can't spot the problem, sometimes it is hard to after you have read and reread the code a hundred times, you might want to just copy and paste again from the edit cart mod into the product_info page.
Let me know how you get on
Justin
-
Re: Editing cart contents -- esp products with attributes
So can I just remove that portion of the IF statements? or just remove the !
if ($products_qty_box_status == 0 or $products_quantity_order_max== 1 or (! is_numeric($_GET['products_id'])) ) {
//Edit Justin replaced the $the_button with a new def. that supports editing, 20071120
//if we the item being displayed was referred here from the cart, we are in edit mode
if (! is_numeric($_GET['products_id'])){
Will this affect the mod from running properly?
Thanks,
kris
-
Re: Editing cart contents -- esp products with attributes
Oh, no you can't remove the if statement! The mod won't run properly. I meant that there is probablya typo there, that you need to fix.
-
Re: Editing cart contents -- esp products with attributes
HI guys,
Quote:
Is evaluating false (ie the products_id appears to be numeric.) When the cart is being edited, the products_id paramater in the product_info page , looks like this:
products_id=181:c9f79d635f23d0c699f806417aec2f6c
Which is not numeric.
Looks just like the error I was getting when I had SEO mod installed with Edit Orders. But Hypnos doesn't seem to be using SEO so where is the extra part of the URL coming from?? And it only happens when there are attributes on the product.
:blink:
-
Re: Editing cart contents -- esp products with attributes
I think I should go off and take a communications course, because i seem to be blurring things for everyone. Sorry.
Zencart adds that extra part on to the products_id, when there are attributes, presumably to fill them in when you get to the product info page. If the long products_id is not there,
i)either the product has no attributes, OR,
ii) the user has not selected any attributes yet, because they have not put it into their cart.
Either way, in this case, there is nothing to edit, so edit_cart just lets it go through the normal logic.
The edit_cart mod just uses the presence of that string as a flag that the product_info page has been called by a user clicking on the products name in the shopping cart. If this is the case it shows an "update cart" button in place of an "add to cart" button. What happens when user clicks on update cart is that the original product is deleted and the new product added.(I am rewriting this part now - but won't be ready for a few days.) If the add to cart button is clicked, a new product is simply added to the cart.
Up till here is all good.
What is happening for Hypnos is that regardless of the extra long products_id being present, the edit_cart mod logic is not detecting that this is a product edit. It shows the add button, not the update button. Gaaaaargh!
Perhaps you can post what you have in your tpl_product_info_display file, Hypnos?
Justin
-
Re: Editing cart contents -- esp products with attributes
Justin,
Thanks for the clear explanation.
-
Re: Editing cart contents -- esp products with attributes
I have just uploaded a new version. It fixes the bug Agamic found, where a product could be silently removed from the shopping cart if a verification error occured while updating it.
If that doesn't affect you, then you don't need to upgrade.
Justin
-
Re: Editing cart contents -- esp products with attributes
What happened to my edit cart mod? It stopped working.:huh:
There is not button on the product display after "click to edit" on the cart page
This is my tpl_product_info_display.php
Code:
<?php
/**
* Page Template
*
* Loaded automatically by index.php?main_page=product_info.<br />
* Displays details of a typical product
*
* @package templateSystem
* @copyright Copyright 2003-2006 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: tpl_product_info_display.php 5369 2006-12-23 10:55:52Z drbyte $
*/
//require(DIR_WS_MODULES . '/debug_blocks/product_info_prices.php');
?>
<?php
//BOF :: Tabbed Products Pro ::
require(DIR_WS_MODULES . 'tabbed_products_pro.php');
//EOF :: Tabbed Products Pro ::
?>
<div class="centerColumn" id="productGeneral">
<!--bof Form start-->
<?php
//*** SA 03-04-08 Justin Edit_Cart Mod 20080224
if(is_numeric($_GET['products_id'])) {
$cartAction="add_product";
}else{
$cartAction = "edit_product_in_cart";
}
echo zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($_GET['products_id']), zen_get_all_get_params(array('action')) . 'action=' . $cartAction), 'post', 'enctype="multipart/form-data"') . "\n";
//the old code follows
/*
echo zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($_GET['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'enctype="multipart/form-data"') . "\n";
*/
//end of add Justin Edit_Cart Mod 20080224
?>
<!--eof Form start-->
<?php if ($messageStack->size('product_info') > 0) echo $messageStack->output('product_info'); ?>
<!--bof Category Icon -->
<?php if ($module_show_categories != 0) {?>
<?php
/**
* display the category icons
*/
require($template->get_template_dir('/tpl_modules_category_icon_display.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_category_icon_display.php'); ?>
<?php } ?>
<!--eof Category Icon -->
<!--bof Prev/Next top position -->
<?php if (PRODUCT_INFO_PREVIOUS_NEXT == 1 or PRODUCT_INFO_PREVIOUS_NEXT == 3) { ?>
<?php
/**
* display the product previous/next helper
*/
require($template->get_template_dir('/tpl_products_next_previous.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_products_next_previous.php'); ?>
<?php } ?>
<!--eof Prev/Next top position-->
<!--bof Main Product Image -->
<?php
if (zen_not_null($products_image)) {
?>
<?php
/**
* display the main product image
*/
require($template->get_template_dir('/tpl_modules_main_product_image.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_main_product_image.php'); ?>
<?php
}
?>
<!--eof Main Product Image-->
<!--bof Product Name-->
<h1 id="productName" class="productGeneral"><?php echo $products_name; ?></h1>
<!--eof Product Name-->
<!--bof Product Price block -->
<h2 id="productPrices" class="productGeneral">
<?php
// base price
if ($show_onetime_charges_description == 'true') {
$one_time = '<span >' . TEXT_ONETIME_CHARGE_SYMBOL . TEXT_ONETIME_CHARGE_DESCRIPTION . '</span><br />';
} else {
$one_time = '';
}
echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : '') . zen_get_products_display_price((int)$_GET['products_id']);
?></h2>
<!--eof Product Price block -->
<!--bof free ship icon -->
<?php if(zen_get_product_is_always_free_shipping($products_id_current) && $flag_show_product_info_free_shipping) { ?>
<div id="freeShippingIcon"><?php echo TEXT_PRODUCT_FREE_SHIPPING_ICON; ?></div>
<?php } ?>
<!--eof free ship icon -->
<!--bof Ask a Questions -->
<span id="productQuestions" class="biggerText">
<br />
<b><?php echo '<a href="' . zen_href_link(FILENAME_ASK_A_QUESTION, 'products_id=' . $_GET['products_id']) . '">' . ASK_A_QUESTION . '</a>'; ?></b>
</span>
<!-- Alternately, you may use the button provided. To do this, insert
<div id="askQuestion" class="biggerText">
<?php //echo '<a href="' . zen_href_link(FILENAME_ASK_A_QUESTION, 'products_id=' . $_GET['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_ASK_A_QUESTION, BUTTON_ASK_A_QUESTION_ALT) . '</a>'; ?></div>
<br />
-->
<!--eof Ask a Questions -->
<!--bof Add to Cart Box -->
<?php
if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {
// do nothing
} else {
?>
<?php
$display_qty = (($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) ? '<p>' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION['cart']->get_quantity($_GET['products_id']) . '</p>' : '');
//*** SA 03-04-08 Start of Edit_Cart Mod Justin 20071120
/*if ($products_qty_box_status == 0 or $products_quantity_order_max== 1) {
// hide the quantity box and default to 1
$the_button = '<input type="hidden" name="cart_quantity" value="1" />' .
zen_draw_hidden_field('products_id', (int)$_GET['products_id']) .
zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
*/
if ($products_qty_box_status == 0 or $products_quantity_order_max== 1 or (! is_numeric($_GET['products_id'])) ) {
//Edit Justin replaced the $the_button with a new def. that supports editing, 20071120
//if the item being displayed was referred here from the cart, we are in edit mode
if (! is_numeric($_GET['products_id'])){
//establish quantity of product in cart
$existing_quantity=$_SESSION['cart']->get_quantity($_GET['products_id']);
//make the edit button
$the_button = '<input type="hidden" name="cart_quantity" value="' . $existing_quantity . '" />' .
zen_draw_hidden_field('products_id', (int)$_GET['products_id']) .
zen_draw_hidden_field('edit_item_id', $_GET['products_id']) .
zen_image_submit(BUTTON_IMAGE_EDIT_CART_CONTENTS, BUTTON_IMAGE_EDIT_CART_CONTENTS_ALT);
//If we were not referred from cart, we are not in edit mode
}else{
// hide the quantity box and default to 1
$the_button = '<input type="hidden" name="cart_quantity" value="1" />' .
zen_draw_hidden_field('products_id', (int)$_GET['products_id']) .
zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
}
//================================End of Edit_Cart mod Justin 20071120
} else {
// show the quantity box
$the_button = PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
}
$display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);
?>
<?php if ($display_qty != '' or $display_button != '') { ?>
<div id="cartAdd">
<?php
echo $display_qty;
echo $display_button;
?>
</div>
<?php } // display qty and button ?>
<?php } // CUSTOMERS_APPROVAL == 3 ?>
<!--eof Add to Cart Box-->
<?php
//BOF :: Tabbed Products Pro ::
echo '<div id="tpptabBlock" style="display:none;">' . $tabData . '</div>';
//EOF :: Tabbed Products Pro ::
?>
<br class="clearLeft" />
<!-- SA 08-07-07
Added clearleft here so that additional images begin
below main images.
-->
<br class="clearLeft" />
<!-- SA 08-07-07
Additional images block moved here to display after main image
-->
<!--bof Additional Product Images -->
<?php
/**
* display the products additional images
*/
require($template->get_template_dir('/tpl_modules_additional_images.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_additional_images.php'); ?>
<!--eof Additional Product Images -->
<!--bof Product description -->
<?php if ($products_description != '') { ?>
<div id="productDescription" class="productGeneral biggerText"><?php echo stripslashes($products_description); ?></div>
<?php } ?>
<!--eof Product description -->
<br class="clearBoth" />
<!--bof Product details list -->
<?php if ( (($flag_show_product_info_model == 1 and $products_model != '') or ($flag_show_product_info_weight == 1 and $products_weight !=0) or ($flag_show_product_info_quantity == 1) or ($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name))) ) { ?>
<ul id="productDetailsList" class="floatingBox back">
<?php echo (($flag_show_product_info_model == 1 and $products_model !='') ? '<li>' . TEXT_PRODUCT_MODEL . $products_model . '</li>' : '') . "\n"; ?>
<?php echo (($flag_show_product_info_weight == 1 and $products_weight !=0) ? '<li>' . TEXT_PRODUCT_WEIGHT . $products_weight . TEXT_PRODUCT_WEIGHT_UNIT . '</li>' : '') . "\n"; ?>
<?php echo (($flag_show_product_info_quantity == 1) ? '<li>' . $products_quantity . TEXT_PRODUCT_QUANTITY . '</li>' : '') . "\n"; ?>
<?php echo (($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name)) ? '<li>' . TEXT_PRODUCT_MANUFACTURER . $manufacturers_name . '</li>' : '') . "\n"; ?>
</ul>
<br class="clearBoth" />
<?php
}
?>
<!--eof Product details list -->
<!--bof Attributes Module -->
<?php
if ($pr_attr->fields['total'] > 0) {
?>
<?php
/**
* display the product atributes
*/
require($template->get_template_dir('/tpl_modules_attributes.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_attributes.php'); ?>
<?php
}
?>
<!--eof Attributes Module -->
<!--bof Quantity Discounts table -->
<?php
if ($products_discount_type != 0) { ?>
<?php
/**
* display the products quantity discount
*/
require($template->get_template_dir('/tpl_modules_products_quantity_discounts.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_products_quantity_discounts.php'); ?>
<?php
}
?>
<!--eof Quantity Discounts table -->
<!--bof Additional Product Images
This block has been moved from this original place and placed after main image
-->
<?php
/**
* display the products additional images
*/
// require($template->get_template_dir('/tpl_modules_additional_images.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_additional_images.php');
?>
<!--eof Additional Product Images -->
<br class="clearBoth" />
<!--bof Prev/Next bottom position -->
<?php if (PRODUCT_INFO_PREVIOUS_NEXT == 2 or PRODUCT_INFO_PREVIOUS_NEXT == 3) { ?>
<?php
/**
* display the product previous/next helper
*/
require($template->get_template_dir('/tpl_products_next_previous.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_products_next_previous.php'); ?>
<?php } ?>
<!--eof Prev/Next bottom position -->
<!--bof Tell a Friend button -->
<?php /*** SA 03-10-08 Added Tell a Friend commented here and added to tpl_product_reviews_default.php so that it goes into the TPP Pro ***/
//if ($flag_show_product_info_tell_a_friend == 1) { ?>
<div id="productTellFriendLink" class="buttonRow forward"><?php //echo ($flag_show_product_info_tell_a_friend == 1 ? '<a href="' . zen_href_link(FILENAME_TELL_A_FRIEND, 'products_id=' . $_GET['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_TELLAFRIEND, BUTTON_TELLAFRIEND_ALT) . '</a>' : ''); ?></div>
<?php
// }
?>
<!--eof Tell a Friend button -->
<!--bof Reviews button and count-->
<?php /*** SA 03-10-08 Reviews button commented here and added to tpl_product_reviews_default.php so that it goes into the TPP Pro ***/
//if ($flag_show_product_info_reviews == 1) {
// if more than 0 reviews, then show reviews button; otherwise, show the "write review" button
//if ($reviews->fields['count'] > 0 ) { ?>
<div id="productReviewLink" class="buttonRow back"><?php //echo '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS, zen_get_all_get_params()) . '">' . zen_image_button(BUTTON_IMAGE_REVIEWS, BUTTON_REVIEWS_ALT) . '</a>'; ?>
</div>
<br class="clearBoth" />
<p class="reviewCount"><?php //echo ($flag_show_product_info_reviews_count == 1 ? TEXT_CURRENT_REVIEWS . ' ' . $reviews->fields['count'] : ''); ?></p>
<?php //} else { ?>
<div id="productReviewLink" class="buttonRow back"><?php //echo '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, zen_get_all_get_params(array())) . '">' . zen_image_button(BUTTON_IMAGE_WRITE_REVIEW, BUTTON_WRITE_REVIEW_ALT) . '</a>'; ?></div>
<br class="clearBoth" />
<?php
// }
//}
?>
<!--eof Reviews button and count -->
<!--bof Product date added/available-->
<?php
if ($products_date_available > date('Y-m-d H:i:s')) {
if ($flag_show_product_info_date_available == 1) {
?>
<p id="productDateAvailable" class="productGeneral centeredContent"><?php echo sprintf(TEXT_DATE_AVAILABLE, zen_date_long($products_date_available)); ?></p>
<?php
}
} else {
if ($flag_show_product_info_date_added == 1) {
?>
<p id="productDateAdded" class="productGeneral centeredContent"><?php echo sprintf(TEXT_DATE_ADDED, zen_date_long($products_date_added)); ?></p>
<?php
} // $flag_show_product_info_date_added
}
?>
<!--eof Product date added/available -->
<!--bof Product URL -->
<?php
if (zen_not_null($products_url)) {
if ($flag_show_product_info_url == 1) {
?>
<p id="productInfoLink" class="productGeneral centeredContent"><?php echo sprintf(TEXT_MORE_INFORMATION, zen_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($products_url), 'NONSSL', true, false)); ?></p>
<?php
} // $flag_show_product_info_url
}
?>
<!--eof Product URL -->
<!--bof also purchased products module-->
<?php require($template->get_template_dir('tpl_modules_also_purchased_products.php', DIR_WS_TEMPLATE, $current_page_base,'templates'). '/' . 'tpl_modules_also_purchased_products.php');?>
<!--eof also purchased products module-->
<!--bof Form close-->
</form>
<!--bof Form close-->
</div>
<?php
//BOF :: Tabbed Products Pro ::
echo $tabjscript;
//BOF :: Tabbed Products Pro ::
?>
-
Re: Editing cart contents -- esp products with attributes
I just peeked at your site and played around a little.
The button seems to be showing up ok. (Hooray?) But all is not well. After I edited a product and pressed the update button, that product vanished from the cart. I cannot tell easily what the problem, but it does appear that you are using some kind of SEO optimised Urls. There is no productId field visible in the URL as a GET paramater. This might be the cause of the problem.
I do not have a lot of time to investigate, sorry. What happened in between it working, and it not working?
Justin
-
Re: Editing cart contents -- esp products with attributes
Hi Justin
Hope you don't mind, but I thought it might be helpful if I jumped in and provided some additional information about the long product ID (aka prid).
You are correct that this is added for attributes. Its primary purpose is to allow the shopping cart to differentiate between variants of the same product that differ only due to the attributes selected. So, for example, the shopping cart will merge products with the same prid, but know to keep the separate products with different prids.
The prid is generated by applying MD5 encryption to the attribute information. There's no particular benefit to the data being encrypted - the real benefit is that MD5 is pretty well guaranteed to produce a unique result for each combination of attributes and therefore there is virtually zero risk of accidentally merging different product variants.
However, MD5 is a one-way encryption technique, so the attribute information cannot be extracted from it. Instead it is passed from the product info page in a $_POST array and is picked up by the shopping cart which then holds the information in a php session array indexed by the prid and from which it can be referenced when needed.
Hope this helps.
-
Re: Editing cart contents -- esp products with attributes
OK that is good information Kuroi, thanks. I wish all of Zen Cart was documented so well.
I figured it was an attributes hash but never bothered to follow the program logic right through. (In fact I don't know why, if this logic is in place, the "edit cart" functionality is not standard.)
In any case, there is a products_id GET parameter that we can use to establish if an item in the cart has attributes selected or not. Because if an item has attributes, the value of the products_id parameter will include an md5 hash as Kuroi described.
For anyone reading who isn't following this, a GET parameter will appear after the main part of the URL, ie the part after index.php, and looks a bit like this param1=a¶m2=b etc
A POST parameter is invisible. You cannot see it in the URL.
I do not know if this is Shockers problem, but it may be, because he is using SEO optimized URLs which do not have any GET parameters on them. It may be that the products_id parameter is not being seen by the Edit Cart mod, and so it is not working properly. The Edit Cart mod, doesn't do much with this information it just directs the form to a special shopping cart action. This all occurs in this section:
Code:
if(is_numeric($_GET['products_id'])) {
$cartAction="add_product";
}else{
$cartAction = "edit_product_in_cart";
}
Later on we add a hidden field, edit_item_id, too
Code:
//make the edit button
$the_button = '<input type="hidden" name="cart_quantity" value="' . $existing_quantity . '" />' .
zen_draw_hidden_field('products_id', (int)$_GET['products_id']) .
zen_draw_hidden_field('edit_item_id', $_GET['products_id']) .
zen_image_submit(BUTTON_IMAGE_EDIT_CART_CONTENTS, BUTTON_IMAGE_EDIT_CART_CONTENTS_ALT);
Shocker if you have added an SEO module recently, my bet is that this is causing the problem. Can you advise?
-
Re: Editing cart contents -- esp products with attributes
Quote:
Originally Posted by
justinhunt
Shocker if you have added an SEO module recently, my bet is that this is causing the problem. Can you advise?
I do have an Ultimate SEO Urls 2.106 mod installed, but this was installed on 1/28/08
I installed Edit Cart 1.1. on 2/29/08.
I had tested this successfully with flying colors.
other mods I've installed AFTER Edit Cart:
Tabbed Products Pro 1.02
Image Handler 2
RSS Feed 2.1.3
Linkpoint API
Thanks for any help.
-
Re: Editing cart contents -- esp products with attributes
I don't know which, if any, of those mods has broken EditCart. If SEO urls was working fine before, it should be working fine now too though.
In your first post you said that the button was not showing, but it seems to be showing now. What did you do to get the button back? When did you last verify the edit cart was working as it should?
The fact that product edits are clearing the cart looks very much like the bug that was fixed on 24th of Feb. What does the extra_cart_actions/edit_cart_item.php file look like? If it is only 10 or so lines, then it is the old version.
I am working in the dark a bit here.
-
Re: Editing cart contents -- esp products with attributes
Quote:
Originally Posted by
justinhunt
I don't know which, if any, of those mods has broken EditCart. If SEO urls was working fine before, it should be working fine now too though.
In your first post you said that the button was not showing, but it seems to be showing now. What did you do to get the button back? When did you last verify the edit cart was working as it should?
The fact that product edits are clearing the cart looks very much like the bug that was fixed on 24th of Feb. What does the extra_cart_actions/edit_cart_item.php file look like? If it is only 10 or so lines, then it is the old version.
I am working in the dark a bit here.
I have to revisit this because I noticed too that the button was showing up, but I don't know in what circumstances that it doesn't. I'll get back to you on this.
This is the edit_cart_item.php
Code:
<?php
/**
* Edit_Cart
*
* Edit an existing product by removing it before it hits the add to cart action
* Author: Justin Hunt http://www.kuroobiya.com 20071120
* Version: 1.1
*/
// intercept add_product actions and if the edit_item_id paramater is set,
//If set, remove that item from cart, and proceed to add it again
if (($_GET['action'] == 'edit_product_in_cart')) {
// $_SESSION['cart']->actionAddProduct($goto, $parameters);
global $messageStack, $db;
if (isset($_POST['products_id']) && is_numeric($_POST['products_id'])) {
// verify attributes and quantity first
$the_list = '';
$adjust_max= 'false';
if (isset($_POST['id'])) {
foreach ($_POST['id'] as $key => $value) {
$check = zen_get_attributes_valid($_POST['products_id'], $key, $value);
if ($check == false) {
$the_list .= TEXT_ERROR_OPTION_FOR . '<span class="alertBlack">' . zen_options_name($key) . '</span>' . TEXT_INVALID_SELECTION . '<span class="alertBlack">' . (zen_values_name($value) == 'TEXT' ? TEXT_INVALID_USER_INPUT : zen_values_name($value)) . '</span>' . '<br />';
}
}
}
// verify qty to add
// $real_ids = $_POST['id'];
//die('I see Add to Cart: ' . $_POST['products_id'] . 'real id ' . zen_get_uprid($_POST['products_id'], $real_ids) . ' add qty: ' . $add_max . ' - cart qty: ' . $cart_qty . ' - newqty: ' . $new_qty);
$add_max = zen_get_products_quantity_order_max($_POST['products_id']);
$cart_qty = $_SESSION['cart']->in_cart_mixed($_POST['products_id']);
$new_qty = $_POST['cart_quantity'];
//here we adjust the existing cart quantity because we are going to remove existig items shortly
$cart_qty= $cart_qty-$new_qty;
//echo 'I SEE actionAddProduct: ' . $_POST['products_id'] . '<br>';
$new_qty = $_SESSION['cart']->adjust_quantity($new_qty, $_POST['products_id'], 'shopping_cart');
if (($add_max == 1 and $cart_qty == 1)) {
// do not add
$new_qty = 0;
$adjust_max= 'true';
} else {
// adjust quantity if needed
if (($new_qty + $cart_qty > $add_max) and $add_max != 0) {
$adjust_max= 'true';
$new_qty = $add_max - $cart_qty;
}
}
if ((zen_get_products_quantity_order_max($_POST['products_id']) == 1 and $_SESSION['cart']->in_cart_mixed($_POST['products_id']) == 1)) {
// do not add
} else {
// process normally
// bof: set error message
if ($the_list != '') {
$messageStack->add('product_info', ERROR_CORRECTIONS_HEADING . $the_list, 'caution');
// $messageStack->add('header', 'REMOVE ME IN SHOPPING CART CLASS BEFORE RELEASE<br/><BR />' . ERROR_CORRECTIONS_HEADING . $the_list, 'error');
} else {
// process normally
// iii 030813 added: File uploading: save uploaded files with unique file names
$real_ids = isset($_POST['id']) ? $_POST['id'] : "";
if (isset($_GET['number_of_uploads']) && $_GET['number_of_uploads'] > 0) {
/**
* Need the upload class for attribute type that allows user uploads.
*
*/
include(DIR_WS_CLASSES . 'upload.php');
for ($i = 1, $n = $_GET['number_of_uploads']; $i <= $n; $i++) {
if (zen_not_null($_FILES['id']['tmp_name'][TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]]) and ($_FILES['id']['tmp_name'][TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] != 'none')) {
$products_options_file = new upload('id');
$products_options_file->set_destination(DIR_FS_UPLOADS);
$products_options_file->set_output_messages('session');
if ($products_options_file->parse(TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i])) {
$products_image_extension = substr($products_options_file->filename, strrpos($products_options_file->filename, '.'));
if ($_SESSION['customer_id']) {
$db->Execute("insert into " . TABLE_FILES_UPLOADED . " (sesskey, customers_id, files_uploaded_name) values('" . zen_session_id() . "', '" . $_SESSION['customer_id'] . "', '" . zen_db_input($products_options_file->filename) . "')");
} else {
$db->Execute("insert into " . TABLE_FILES_UPLOADED . " (sesskey, files_uploaded_name) values('" . zen_session_id() . "', '" . zen_db_input($products_options_file->filename) . "')");
}
$insert_id = $db->Insert_ID();
$real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] = $insert_id . ". " . $products_options_file->filename;
$products_options_file->set_filename("$insert_id" . $products_image_extension);
if (!($products_options_file->save())) {
break;
}
} else {
break;
}
} else { // No file uploaded -- use previous value
$real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] = $_POST[TEXT_PREFIX . UPLOAD_PREFIX . $i];
}
}
}
$_SESSION['cart']->add_cart($_POST['products_id'], $_SESSION['cart']->get_quantity(zen_get_uprid($_POST['products_id'], $real_ids))+($new_qty), $real_ids);
// iii 030813 end of changes.
} // eof: set error message
} // eof: quantity maximum = 1
if ($adjust_max == 'true') {
$messageStack->add_session('shopping_cart', ERROR_MAXIMUM_QTY . ' B: - ' . zen_get_products_name($_POST['products_id']), 'caution');
}
}
if ($the_list == '') {
// no errors
// display message if all is good and not on shopping_cart page
if (DISPLAY_CART == 'false' && $_GET['main_page'] != FILENAME_SHOPPING_CART) {
$messageStack->add_session('header', SUCCESS_ADDED_TO_CART_PRODUCT, 'success');
}
//remove the existing item
$_SESSION['cart']->remove($_POST['edit_item_id']);
//head off to our destination
zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
} else {
// errors - display popup message
}
}
?>
-
Re: Editing cart contents -- esp products with attributes
I'm still trying to work out a ZenId weirdness issue. Could this affect the edit cart functionality?
-
Re: Editing cart contents -- esp products with attributes
Sorry Shocker I have been out of action for a few weeks. Started a new job, sigh. Zencart was supposed to rid me of that tyranny!
I don't know what you mean by Zenid weirdness issue. I really don't have enough information to work with to help you out. You talked about a button problem but I could not see that.
The only problem I could see was where an edited product, was quietly removed from the cart. That looks like the workings of the old version. The new version only removes the pre edit product after the post edit one has been added. If the post edit one can't be added, the pre edit one is not removed. Are you sure you don't have old files from the previous edit cart version in there?
No one else is reporting this problem, so I think something is screwy is going on, in your system.
You might want to try:
1) creating a new dummy product with only one dummy attribute and seeing how edit cart mod works.
2) removing edit cart completely and re installing
3) removing other mods you have installed and see if their removal affects edit cart
If you are experiencing weirdness in other areas (you said zenid, and the mysterious button) then it may be connected. But I don't know the specifics so I can't really say.
Justin Hunt
-
Re: Editing cart contents -- esp products with attributes
hello
I installed edit cart, works fine, I believe but the "click to edit" text is missing from product link on shopping cart. Please assist
Thank you again
-
Re: Editing cart contents -- esp products with attributes
Quote:
Originally Posted by
justinhunt
Sorry Shocker I have been out of action for a few weeks. Started a new job, sigh. Zencart was supposed to rid me of that tyranny!
I don't know what you mean by Zenid weirdness issue. I really don't have enough information to work with to help you out. You talked about a button problem but I could not see that.
The only problem I could see was where an edited product, was quietly removed from the cart. That looks like the workings of the old version. The new version only removes the pre edit product after the post edit one has been added. If the post edit one can't be added, the pre edit one is not removed. Are you sure you don't have old files from the previous edit cart version in there?
No one else is reporting this problem, so I think something is screwy is going on, in your system.
You might want to try:
1) creating a new dummy product with only one dummy attribute and seeing how edit cart mod works.
2) removing edit cart completely and re installing
3) removing other mods you have installed and see if their removal affects edit cart
If you are experiencing weirdness in other areas (you said zenid, and the mysterious button) then it may be connected. But I don't know the specifics so I can't really say.
Justin Hunt
Thanks for getting back to me. I don't know what's up. The edit cart contents mod seems to be fine now.
I'll check this from time to time and try to pay more close attention to the scenario.
Thanks for your attention.
-
Re: Editing cart contents -- esp products with attributes
OK Shocker, glad it is working for you.
Zafer, You will have to edit your tpl_shopping_cart_default.php file, and add the "click to edit" text. The details are in the read me file with the edit cart mod you downloaded.
Justin
-
Re: Editing cart contents -- esp products with attributes
hi,
I have tried this mod, and it is great.
However, there are some suggestion which may make it better:
1. Is it possible to put a link in the cart page, which link "Edit Product Option" just besides the product name or else where.
However, the link is NOT link back to the product page, it can be a popup page, and it only show the product option.
so that buyer DO NOT need to go back to the product page and reload the whole page.
2. if using the 1 suggestion, there is no need to worry about the SEO link problem.
3. if using the 1 suggestion, there is NO need to modify the cored product info page, else well else the shopping cart tpl.
it is supposed to add ONE line like this:
<a href="update cart page url">Edit Product Option Here</a>
sorry that i don't know too much php, but i guess it is more easy for the future upgrade and modification.
hope Justin can take my suggestion in the new release.
-
Re: Editing cart contents -- esp products with attributes
Thanks for the tip. I guess something like this could be done.
Personally i do not see a great deal of gain in it, because there is no real problem with how it works now. Admittedly though a separate page soley for editing option attributes, might be useful.
Thanks for the idea.
-
Re: Editing cart contents -- esp products with attributes
Quote:
Originally Posted by
justinhunt
Thanks for the tip. I guess something like this could be done.
Personally i do not see a great deal of gain in it, because there is no real problem with how it works now. Admittedly though a separate page soley for editing option attributes, might be useful.
Thanks for the idea.
hi,
I am not if other store have this problem.
but for my store, we are selling radio control toys.
many buyer will buy TWO same item, but with different option.
say, he may add product A with option 35Mhz to the cart.
later on, on the checkout page, he may want to buy another one.
normally, they will click on the item link in the shopping cart page.
in this case, they will add the SAME item, but with another option.
however, for the current edit cart, people click on the item link.
it will MODIFY the current item instead of ADD a NEW item.
another quick way is seperate the EDIT option link and Item link in the shopping cart page.
however, when i try to modify your code, it seems that you check user is click "from the cart page" in order to determinate it should be NEW item or modify item.
by the way, if i need the mod that i mention, i willing to pay for this.
can you write it for me?
-
Re: Editing cart contents -- esp products with attributes
OK, I see the issue. If they click on the link in the shopping cart page, it shows them the edit options page for that cart item.
But you want them to be able to choose from the cart either
i) Edit the item
OR
ii) Add another of those items, (and be able to set a different set of options for it)
(Please correct me if I didn't get it)
You are right that the current mod, defaults to Edit Mode if the user clicks on the item title in the cart. To add an "Add another of these" button as well as the current "Edit options" link. It is not a very big job.
So small I do not think I would charge for doing it. But I am really busy and can't committ myself to providing decent support. Which is the other reason why I won't charge for it. (It is also the reason I haven't released any of my other mods. Is that bad?)
When do you need it by?
-
Re: Editing cart contents -- esp products with attributes
thanks for your quick response.
I think add a link in the cart page:
[Edit This item Option]
is good.
If buyer clikc on this link, then he is supposed to EDIT the current item which is in the cart.
If the buyer click on the item image or the name (that what the current zen cart do)
then he is suppose to add a NEW item, rather than UPDATE the product option.
Sorry that I don't want to force you to do that...
acutally, i just want to make some suggestion.
you are always welcome to do it if you are free.
i just want to get this mod quick as i really need it.
for the money, i just think that we can't give any support to all great programmer, like you.
you may treat it as donation rather than "real charge for me"
by the way, i really looking for the mod that i want, which is a seperate page to modify the product option.
as it can give much better shopping experience to the buyer when they edit the option.
they will clear to notice that they are EDIT the option, and won't be confuse.
also, for the upgrade, it is really much more easier, as i know many people already modified that prodcut info template.
again, all of the above is just my personal suggestion~~
^####################^
-
Re: Editing cart contents -- esp products with attributes
hello there,
i have a problem with the edit_cart module:
- clicking on a product (with attributes) the product page appear, with the "edit product" button
- now, when you change an attribute, everything goes well, the product is updatet with the new attributes.
but if i DONT change any of the attributes and click "edit product", the products gets deleted from cart.
i've been searching about 4 hours for the error, but can't find nor fix it ^^
can someone help me ?
lukas
-
Re: Editing cart contents -- esp products with attributes
ok solved it on my own:
do the following changes in /includes/extra_cart_actions/edit_cart_item.php:
arround line 176:
1. replace
Code:
$_SESSION['cart']->add_cart($_POST['products_id'], $_SESSION['cart']->get_quantity(zen_get_uprid($_POST['products_id'], $real_ids)), $real_ids);
with
Code:
if ($_POST['edit_item_id'] != zen_get_uprid($_POST['products_id'], $real_ids))
$_SESSION['cart']->add_cart($_POST['products_id'], $_SESSION['cart']->get_quantity(zen_get_uprid($_POST['products_id'], $real_ids))+($new_qty), $real_ids);
else
$_SESSION['cart']->add_cart($_POST['products_id'], $_SESSION['cart']->get_quantity(zen_get_uprid($_POST['products_id'], $real_ids)), $real_ids);
arround line 210
2. replace
Code:
//remove the existing item
$_SESSION['cart']->remove($_POST['edit_item_id']);
with
Code:
//remove the existing item
if ($_POST['edit_item_id'] != zen_get_uprid($_POST['products_id'], $real_ids))
$_SESSION['cart']->remove($_POST['edit_item_id']);
actually i didn't get the exact logic behind it, but it should work :)
cheers,
lukas
-
Re: Editing cart contents -- esp products with attributes
Thanks Lukas
Actually I could not reproduce that error myself, but hope to be able to have a another crack at it soon. In the meantime thanks for posting the code. It is a big help.
Justin
-
Re: Editing cart contents -- esp products with attributes
Hi there Justin and everyone else
i've installed this on a shop running with Price by Attribute...
Ok everything is installed nicely, but when i get back to my cart it still adds a new product on top of the edited product...
I uploaded everything for sure. But the edit button just seems to work like the old Add to Cart button!
www.bluedclothing.com/shop/
shop needs to be delivered soon... :-(
Thanks in advance for any help provided.
Jonathan
-
Re: Editing cart contents -- esp products with attributes
Hi Jonathan,
please post lines 175-177 and 209-211 of your /includes/extra_cart_actions/edit_cart_item.php.
to see if the relevant changes were made...
Lukas
-
Re: Editing cart contents -- esp products with attributes
Hi Elkay
Here goes...
PHP Code:
//edited in version 1-2 by elkay on 12.07.2008
if ($_POST['edit_item_id'] != zen_get_uprid($_POST['products_id'], $real_ids))
$_SESSION['cart']->add_cart($_POST['products_id'], $_SESSION['cart']->get_quantity(zen_get_uprid($_POST['products_id'], $real_ids))+($new_qty), $real_ids);
else
$_SESSION['cart']->add_cart($_POST['products_id'], $_SESSION['cart']->get_quantity(zen_get_uprid($_POST['products_id'], $real_ids)), $real_ids);
//edit elkay end
and
PHP Code:
}
//remove the existing item
/*line added by elkay with v1-2 on 12.07.2008*/ if ($_POST['edit_item_id'] != zen_get_uprid($_POST['products_id'], $real_ids))
$_SESSION['cart']->remove($_POST['edit_item_id']);
//head off to our destination
Everything seems fine...so I don't get it...
I took the link "edit cart" off , but i'll put it back on so u can try it
http://www.bluedclothing.com/shop/
my products are priced by attributes...u have different sizes (S, L, M, XL) for which u can enter any quantity - it multiplies the total price.
Anyway, whenever u change any attribute (even color...or whatever), it still leaves an extra product in the cart and doesn't perform the actual delete there.
Thanks for the help!
Jonathan
-
Re: Editing cart contents -- esp products with attributes
Hi Jonathon and Lukas
First up thanks for your bug fixes Lukas. I was a bit suprised to see someone else chipping in (since I kind of haven't been!) . But it was a nice surprise. Our primary shop is almost a full time job these days, which is great, but bloody tiring, since I already have a fulltime job. So I just don't have time to look at this stuff very often now.
Jonathon are you running any other non standard mods, in particular any SEO mods that modify your urls?
Justin
-
Re: Editing cart contents -- esp products with attributes
I had a quick peek at your site Jonathon.
The problem is with your productinfo page. It is not reading the url properly and so is showing the add button, not the edit button. Are you sure that the edit_cart module was installed properly?
I would check that you have changed the code in the product info page as per the instructions. It appears that you may not have.
Quoting step 4 from the read me
Quote:
4. Edit your existing includes/templates/TEMPLATE_NAME/templates/tpl_product_info_display.php file, to match the one included in the Product_Info_Display folder.
There are two sections to edit:
i) between <!--bof Form start--> and <!--bof Form end-->
and
ii) just after <!--bof Add to Cart Box -->
The places to edit are all commented. If you search for "Edit_Cart" you will see them.
Justin
-
Re: Editing cart contents -- esp products with attributes
Hi Justin
Good to hear from you!
I had to disable it on the site, but what i'll do is re-install your mod,
Other thing, my client wants the button to still say "add to cart" instead of "edit cart" when editing a product, so I'll have to change this myself (not a prob on my end)...so if you retest my site, you will see that button say "Add to Cart" k?
Thanks for the support!
Spk soon
J
-
Re: Editing cart contents -- esp products with attributes
Hey
When i go to tthe download page for your mod, it says v.1.2
However when I open it, the files all say v1.1
Can u double check that??
Thanks
Jonathan
-
Re: Editing cart contents -- esp products with attributes
I re-uploaded things, I worked making sure the code is inserted properly, and well, all i can say is IT WORKS!!! Yay!
Must have done somethn wrong...before.
Oh I had to comment lines that had to do with a module called "Attribute Grid" (I wasn't using the mod anyway) which weren't disabled first time I installed "edit cart" ...could be what caused me problems first time...
Ok thanks for this great mod!
Client will be HAPPY!
Cheers
Jonathan
-
Re: Editing cart contents -- esp products with attributes
Great that is good news. Hope the client is happy.
Justin
-
Re: Editing cart contents -- esp products with attributes
Hello everyone,
I'm having some trouble with this mod. I add a product (with attributes) to the cart, I think click the name to go to the edit screen. I edit that attributes, and the button says Update the cart.
But when I click it, I go to a "Your Shopping Cart is Empty" page. I guess the mod is deleting the old product but not creating the new one?
The Form tag on the edit page reads like this:
Code:
<form name="cart_quantity" action="http://########################vices.ehpub.com/store/index.php?main_page=product_info&products_id=6%3A63e472cb4f0c2a3123aacb2a14cb943e&number_of_uploads=2&action=edit_product_in_cart" method="post" enctype="multipart/form-data">
Unfortunately the store is still in development and not on a public server, so I can't show it working. :(
Any idea what could be wrong? This is the first mod I've applied to Zen cart and I'm a new user so I wonder if I borked the install?
-
Re: Editing cart contents -- esp products with attributes
OK a little more info...
It looks like I'm getting a TRUE at this if statement:
Code:
if ((zen_get_products_quantity_order_max($_POST['products_id']) == 1 and $_SESSION['cart']->in_cart_mixed($_POST['products_id']) == 1)) {
Which is preventing any actual editing of the attributes.
Then at the end of the edit_product_in_cart routine
Code:
$_SESSION['cart']->remove($_POST['edit_item_id']);
Is removing the existing item.
So this is looking like a problem with the way I have my items set up.
I have Product Qty Maximum: 1 in the Product Set up page because I want the Qty Box suppressed (and attributes are required, so it makes no sense to but a quantity of more than one).
Am I handling this wrong?
-
Re: Editing cart contents -- esp products with attributes
No one has any ideas, I guess?
-
Re: Editing cart contents -- esp products with attributes
Hi Pasmith,
There's a better way to suppress your quantities box without setting it to 1 so that it has this negative effect on this mod.
I don't know what it is offhand, but I know I've seen it here on the form.
I would go to the section of the form for customizing and set up and search for 'hide quantities box" or "turn off quantity box" or something of that nature.
I'm confident you'll be able to find the answer to that particular issue. And perhaps it will solve this one for you.
-
Help With Edit Cart Mod
Hi everyone,
My edit cart button isn't showing. When I click the link to go back and edit the cart, I see the "add to cart" button.
Now...the functionality works like it should, it's just that the wrong button is displayed. And what's really cool is that it accepts negative numbers...so let's say I have a quantity of five and want to change it to 0. I simply put in -4.
Since the button ADDS to the cart, that's the only way to do it unless I want to empty the cart and go back and add to it again.
Problem is, this will be confusing for visitors/customers.
So, I'd really like for my "update cart" button to show.
Here's the code from the file located here:
/includes/templates/MY_TEMPLATE/templates/tpl_product_info_display.php
Quote:
//add Justin Edit_Cart Mod 20080224
if(is_numeric($_GET['products_id'])) {
$cartAction="add_product";
}else{
$cartAction = "edit_product_in_cart";
}
echo zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($_GET['products_id']), zen_get_all_get_params(array('action')) . 'action=' . $cartAction), 'post', 'enctype="multipart/form-data"') . "\n";
Suggestions?
I know Justin has a full time job plus his internet business, so he's pretty busy and doesn't get here that often. Can anyone else chime in?
-
Re: Editing cart contents -- esp products with attributes
Hey ScriptJunkie
Sorry I got here a bit late, Ah, I had a wee squiz at your site. ( I am guessing it is empowermentsanctuary.com)
The edit cart mod won't work if are not using attributes. The line that you quoted:
Code:
if(is_numeric($_GET['products_id'])) {
$cartAction="add_product";
}else{
$cartAction = "edit_product_in_cart";
}
is in fact the heart of the matter. If you are using attributes those attributes will be passed in as a hash in the products_id and it won't be numeric. If you are not using attributes, the products_id will always be numeric. Try adding some attributes to one of your test products (eg size : small, medium , large) and see if it works then.
Good luck
Justin
-
Re: Editing cart contents -- esp products with attributes
Hi Pasmith
Sorry to be a bit slow, I hope you solved it, but if not ...
I can't be sure what is wrong with your setup, but your guess that it is to do with the max quantity would be my guess too.
The mod first adds the edited product as a new product, so that you have two items in your cart. Provided there was no error in doing so, it then deletes the original item. Leaving you with just one product.
If however the new product could not be added, but no error was thrown, then the old product would be deleted leaving nothing in the cart.
Have you tried removing the max product quantity restriction? If you do this and it works, you could just leave it like that. But if that is not satisfactory, I would change
Code:
if ((zen_get_products_quantity_order_max($_POST['products_id']) == 1 and $_SESSION['cart']->in_cart_mixed($_POST['products_id']) == 1)) {
to
Code:
if ((zen_get_products_quantity_order_max($_POST['products_id']) == 1 and $_SESSION['cart']->in_cart_mixed($_POST['products_id']) == 2)) {
or if you are feeling particularly bold
change it to
since this code was copied from the standard add_to_cart action, but is only called when editing a product, so in actual fact is redundant.
There may be other places that you need to change. If this is all above your head, I can have a look at it for you, but please try it out for yourself first.
Good luck
J
-
Re: Editing cart contents -- esp products with attributes
Hiya Justin,
Thanks for the reply! I got it sorted out, first by doing the "if false" but then I realized I wasn't understand the max items stuff in ZenCart properly. So I got rid of the max quantity limitation and reverted to an un-edited version of your script, and everything is looking good.
Thanks!
-
Re: Editing cart contents -- esp products with attributes
OK that is good news. I hope from now you can get on and make some money then ,..
-
Re: Editing cart contents -- esp products with attributes
Hi Justin,
Thank you for the reply, I know how busy you are and your time is greatly appreciated!
Yes, my site is empowermentsanctuary.com, but my store is located at empowermentsanctuary.com/marketplace.
Thanks for the tip on the attributes. None of the test products I've put in so far have any, hence the problem! I will be setting up attributes once I load the cart with actual products.
It seems I was just putting the cart before the horse in this case :)
Thanks again for the reassurance. If I have any issues or questions once I tweak a test product, I'll stop back by.
-
Re: Editing cart contents -- esp products with attributes
Hi Guys,
I tried this mod and have a problem that no one else has mentioned yet...
I added the [click to edit] code (and noticed that Justin's mod shows this as a div, v1.3.8a seems to have changed this to a span) and when I click on this when an item has attributes it seems to work, it shows a button that says "edit cart contents" but I could have sworn Justin's site said "Update Cart" which makes a lot more sense since I don't want to edit the cart contents at this point, I want to update the product and send that back to the cart...
Anyhow, I digress... when I change an attribute's value and click the edit cart button it dumps me to a blank page... If I hit the back button and return to my shopping cart everything is as it was before attempting to edit the attribute.
Does any one have any ideas?
Also, I noticed that the readme says: "Edit your existing includes/templates/TEMPLATE_NAME/templates/tpl_product_info_display.php file, to match the one included in the Product_Info_Display folder."
But v1.3.8a uses "YOUR_TEMPLATE" and not "TEMPLATE_NAME" but when I looked into the mods dir structure the was no reference to a dir named "TEMPLATE_NAME", It seems that the files are instead dumped into the "classic" folder. I tried to place those files in my template dir after getting the above error but it made no noticeable difference.
I have turned this mod off as this is a live cart, Any help would be greatly appreciated.
Gary777
-
Re: Editing cart contents -- esp products with attributes
Blank pages are caused by PHP errors, often a result of bad uploads or incorrect edits to files.
See the debug logging utility mentioned in this FAQ on the topic of blank pages: https://www.zen-cart.com/tutorials/index.php?article=82
-
Re: Editing cart contents -- esp products with attributes
Hi Gary
Sorry about the problems.
As Dr Byte mentions, blank pages are pretty hard to figure out if it is not your code, and you generally have to get a bit technical. But to me it sounds like your install has not gone well.
There may be differences between my original version and the patched version that Elkay put up, but that is probably not the cause of your problem.
I suggest you make sure that all the files from the mod you downloaded are present and in the right locations in your shop. If that is OK, then go back through each step of the read me and make sure you have followed the instructions to the letter.
If there is still no joy, completely remove the mod and start again.
Justin
PS I know it is a pain in the ########, but really you should have a copy of your zencart that you try things out on. It can be a local copy on your PC or just another install of Zencart on your webhost, that is not accessible to the general public. When you have tested out your mod or your changes , and they are working, then you upload them from there. Once your site has gone live, and you have customers, down time costs money.
-
Re: Editing cart contents -- esp products with attributes
Hi DrByte & Justin,
First off, I hope I didn't come off as being a whiner, I only pointed out the differences in the install package from the docs and what's on Justin's site as I suspected that may have had something to do with the problem, and if I saw those differences I'm sure others will also...
Interestingly enough I have been working on a side project to document the files in mods and compare them against the base install and other mods installed. I believe it would help keep things straight and now I have a chance to use it for a practical purpose... Here are the list of files that were in the version 1-2 elkay download.
Code:
\includes\extra_cart_actions\edit_cart_item.php
\includes\languages\english\extra_definitions\edit_cart_button_names.php
\includes\languages\german\extra_definitions\edit_cart_button_names.php
\includes\templates\classic\buttons\english\button_edit_cart_contents.gif
\includes\templates\classic\buttons\german\button_edit_cart_contents.gif
\includes\templates\YOUR_TEMPLATE\templates\tpl_product_info_display.php
I just downloaded version 1-2 of the mod again, and version 1-1 and the files checkout however the dir structure of 1-2 is in fact different from 1-1, elkay dumped the files into classic as opposed to YOUR_TEMPLATE dir, I changed that on my install.
I reloaded the files and re-edited tpl_product_info_display.php but I am still getting a blank page upon hitting the "Edit Cart Contents" button.
I was going to try using version 1-1 next to see if that helps but out of curiosity I compared v1-1 with v1-2, I thought i read that v1-2 fixes a bug that deletes an item from a cart when no changes were made... However upon comparing the 2 versions I found them to be identical!
Now I am really confused, any ideas guys? I am including my tpl_product_info_display.php for your perusal...
Justin -> I started installing an updated local version of this cart install lastnight, I had originally tested it on a local machine but uploaded it so the customer could critique it, now I need to reload it will the additional mods I have made. And your right, it is a pain!
Thanks guys,
Gary777
Code:
<?php
/**
* Page Template
*
* Loaded automatically by index.php?main_page=product_info.<br />
* Displays details of a typical product
*
* @package templateSystem
* @copyright Copyright 2003-2006 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: tpl_product_info_display.php 5369 2006-12-23 10:55:52Z drbyte $
*/
//require(DIR_WS_MODULES . '/debug_blocks/product_info_prices.php');
?>
<div class="centerColumn" id="productGeneral">
<!--bof Form start-->
<?php
//add Justin Edit_Cart Mod 20080224
if(is_numeric($_GET['products_id'])) {
$cartAction="add_product";
}else{
$cartAction = "edit_product_in_cart";
}
echo zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($_GET['products_id']), zen_get_all_get_params(array('action')) . 'action=' . $cartAction), 'post', 'enctype="multipart/form-data"') . "\n";
//the old code follows
/*
echo zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($_GET['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'enctype="multipart/form-data"') . "\n";
*/
//end of add Justin Edit_Cart Mod 20080224
?>
<!--eof Form start-->
<?php if ($messageStack->size('product_info') > 0) echo $messageStack->output('product_info'); ?>
<!--bof Category Icon -->
<?php if ($module_show_categories != 0) {?>
<?php
/**
* display the category icons
*/
require($template->get_template_dir('/tpl_modules_category_icon_display.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_category_icon_display.php'); ?>
<?php } ?>
<!--eof Category Icon -->
<!--bof Prev/Next top position -->
<?php if (PRODUCT_INFO_PREVIOUS_NEXT == 1 or PRODUCT_INFO_PREVIOUS_NEXT == 3) { ?>
<?php
/**
* display the product previous/next helper
*/
require($template->get_template_dir('/tpl_products_next_previous.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_products_next_previous.php'); ?>
<?php } ?>
<!--eof Prev/Next top position-->
<!--bof Main Product Image -->
<?php
if (zen_not_null($products_image)) {
?>
<?php
/**
* display the main product image
*/
require($template->get_template_dir('/tpl_modules_main_product_image.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_main_product_image.php'); ?>
<?php
}
?>
<!--eof Main Product Image-->
<!--bof Product Name-->
<h1 id="productName" class="productGeneral"><?php echo $products_name; ?></h1>
<!--eof Product Name-->
<!--bof Product Price block -->
<h2 id="productPrices" class="productGeneral">
<?php
// base price
//***********************************************************************
//***DISPLAY NET RETAIL PRICE IF WHOLESALE CUSTOMER IS LOGGED ON
//***********************************************************************
if ($_SESSION['customer_id']) {
$customers_id = $_SESSION['customer_id'];
$customer_check = $db->Execute("select * from " . TABLE_CUSTOMERS . " where customers_id = '$customers_id'");
if ($customer_check->fields['customers_whole'] != "0") {
echo '<span id="retailwhole">' . ' Retail Price: '.$one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == '1') ? TEXT_BASE_PRICE : '') . zen_get_products_display_retail_net_price((int)$_GET['products_id']).'</span><br /> ';
}
}
//***********************************************************************
//***END DISPLAY NET RETAIL PRICE IF WHOLESALE CUSTOMER IS LOGGED ON
//***********************************************************************
if ($show_onetime_charges_description == 'true') {
$one_time = ' <span> Your Price: ' . TEXT_ONETIME_CHARGE_SYMBOL . TEXT_ONETIME_CHARGE_DESCRIPTION . '</span><br />';
} else {
$one_time = '';
}
//*********************************************************************************
//***Properly display price labeling when set to Whole sale and when not
//*********************************************************************************
if ($_SESSION['customer_id']) {
$customers_id = $_SESSION['customer_id'];
$customer_check = $db->Execute("select * from " . TABLE_CUSTOMERS . " where customers_id = '$customers_id'");
if ($customer_check->fields['customers_whole'] != "0") {
echo '<span id="whole">Whole Sale Price: ';
} else {
echo '<span id="retail">Retail Price: ';
}
} else {
echo '<span id="retail">Retail Price: ';
}
echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : '') . zen_get_products_display_price((int)$_GET['products_id']);
echo '</span>';
//*********************************************************************************
//***END Properly display price labeling when set to Whole sale and when not
//*********************************************************************************
?></h2>
<!--eof Product Price block -->
<!--bof free ship icon -->
<?php if(zen_get_product_is_always_free_shipping($products_id_current) && $flag_show_product_info_free_shipping) { ?>
<div id="freeShippingIcon"><?php echo TEXT_PRODUCT_FREE_SHIPPING_ICON; ?></div>
<?php } ?>
<!--eof free ship icon -->
<!--bof Product description -->
<?php if ($products_description != '') { ?>
<div id="productDescription" class="productGeneral biggerText"><?php echo stripslashes($products_description); ?></div>
<?php } ?>
<!--eof Product description -->
<br class="clearBoth" />
<!--bof Add to Cart Box -->
<?php
if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {
// do nothing
} else {
?>
<?php
$display_qty = (($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) ? '<p>' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION['cart']->get_quantity($_GET['products_id']) . '</p>' : '');
//Start of Edit_Cart Mod Justin 20071120
/*if ($products_qty_box_status == 0 or $products_quantity_order_max== 1) {
// hide the quantity box and default to 1
$the_button = '<input type="hidden" name="cart_quantity" value="1" />' .
zen_draw_hidden_field('products_id', (int)$_GET['products_id']) .
zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
*/
if ($products_qty_box_status == 0 or $products_quantity_order_max== 1 or (! is_numeric($_GET['products_id'])) ) {
//Edit Justin replaced the $the_button with a new def. that supports editing, 20071120
//if the item being displayed was referred here from the cart, we are in edit mode
if (! is_numeric($_GET['products_id'])){
//establish quantity of product in cart
$existing_quantity=$_SESSION['cart']->get_quantity($_GET['products_id']);
//make the edit button
$the_button = '<input type="hidden" name="cart_quantity" value="' . $existing_quantity . '" />' .
zen_draw_hidden_field('products_id', (int)$_GET['products_id']) .
zen_draw_hidden_field('edit_item_id', $_GET['products_id']) .
zen_image_submit(BUTTON_IMAGE_EDIT_CART_CONTENTS, BUTTON_IMAGE_EDIT_CART_CONTENTS_ALT);
//If we were not referred from cart, we are not in edit mode
}else{
// hide the quantity box and default to 1
$the_button = '<input type="hidden" name="cart_quantity" value="1" />' .
zen_draw_hidden_field('products_id', (int)$_GET['products_id']) .
zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
}
//================================End of Edit_Cart mod Justin 20071120
} else {
// show the quantity box
$the_button = PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
}
$display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);
?>
<?php if ($display_qty != '' or $display_button != '') { ?>
<div id="cartAdd">
<?php
echo $display_qty;
echo $display_button;
?>
</div>
<?php } // display qty and button ?>
<?php } // CUSTOMERS_APPROVAL == 3 ?>
<!--eof Add to Cart Box-->
<!--bof Product details list -->
<?php if ( (($flag_show_product_info_model == 1 and $products_model != '') or ($flag_show_product_info_weight == 1 and $products_weight !=0) or ($flag_show_product_info_quantity == 1) or ($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name))) ) { ?>
<ul id="productDetailsList" class="floatingBox back">
<?php echo (($flag_show_product_info_model == 1 and $products_model !='') ? '<li>' . TEXT_PRODUCT_MODEL . $products_model . '</li>' : '') . "\n"; ?>
<?php echo (($flag_show_product_info_weight == 1 and $products_weight !=0) ? '<li>' . TEXT_PRODUCT_WEIGHT . $products_weight . TEXT_PRODUCT_WEIGHT_UNIT . '</li>' : '') . "\n"; ?>
<?php echo (($flag_show_product_info_quantity == 1) ? '<li>' . $products_quantity . TEXT_PRODUCT_QUANTITY . '</li>' : '') . "\n"; ?>
<?php echo (($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name)) ? '<li>' . TEXT_PRODUCT_MANUFACTURER . $manufacturers_name . '</li>' : '') . "\n"; ?>
</ul>
<br class="clearBoth" />
<?php
}
?>
<!--eof Product details list -->
<!--bof Attributes Module -->
<?php
if ($pr_attr->fields['total'] > 0) {
?>
<?php
/**
* display the product atributes
*/
require($template->get_template_dir('/tpl_modules_attributes.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_attributes.php'); ?>
<?php
}
?>
<!--eof Attributes Module -->
<!--bof Quantity Discounts table -->
<?php
if ($products_discount_type != 0) { ?>
<?php
/**
* display the products quantity discount
*/
require($template->get_template_dir('/tpl_modules_products_quantity_discounts.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_products_quantity_discounts.php'); ?>
<?php
}
?>
<!--eof Quantity Discounts table -->
<!--bof Additional Product Images -->
<?php
/**
* display the products additional images
*/
require($template->get_template_dir('/tpl_modules_additional_images.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_additional_images.php'); ?>
<!--eof Additional Product Images -->
<!--bof Prev/Next bottom position -->
<?php if (PRODUCT_INFO_PREVIOUS_NEXT == 2 or PRODUCT_INFO_PREVIOUS_NEXT == 3) { ?>
<?php
/**
* display the product previous/next helper
*/
require($template->get_template_dir('/tpl_products_next_previous.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_products_next_previous.php'); ?>
<?php } ?>
<!--eof Prev/Next bottom position -->
<!--bof Warranty in Products Info page at bottom - GH -->
<?php include('includes/languages/english/html_includes/CDMP/define_page_2.php') ; ?>
<!--eof Warranty in Products Info page at bottom - GH -->
<!--bof Tell a Friend button -->
<?php
if ($flag_show_product_info_tell_a_friend == 1) { ?>
<div id="productTellFriendLink" class="buttonRow forward"><?php echo ($flag_show_product_info_tell_a_friend == 1 ? '<a href="' . zen_href_link(FILENAME_TELL_A_FRIEND, 'products_id=' . $_GET['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_TELLAFRIEND, BUTTON_TELLAFRIEND_ALT) . '</a>' : ''); ?></div>
<?php
}
?>
<!--eof Tell a Friend button -->
<!--bof Reviews button and count-->
<?php
if ($flag_show_product_info_reviews == 1) {
// if more than 0 reviews, then show reviews button; otherwise, show the "write review" button
if ($reviews->fields['count'] > 0 ) { ?>
<div id="productReviewLink" class="buttonRow back"><?php echo '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS, zen_get_all_get_params()) . '">' . zen_image_button(BUTTON_IMAGE_REVIEWS, BUTTON_REVIEWS_ALT) . '</a>'; ?></div>
<br class="clearBoth" />
<p class="reviewCount"><?php echo ($flag_show_product_info_reviews_count == 1 ? TEXT_CURRENT_REVIEWS . ' ' . $reviews->fields['count'] : ''); ?></p>
<?php } else { ?>
<div id="productReviewLink" class="buttonRow back"><?php echo '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, zen_get_all_get_params(array())) . '">' . zen_image_button(BUTTON_IMAGE_WRITE_REVIEW, BUTTON_WRITE_REVIEW_ALT) . '</a>'; ?></div>
<br class="clearBoth" />
<?php
}
}
?>
<!--eof Reviews button and count -->
<!--bof Product date added/available-->
<?php
if ($products_date_available > date('Y-m-d H:i:s')) {
if ($flag_show_product_info_date_available == 1) {
?>
<p id="productDateAvailable" class="productGeneral centeredContent"><?php echo sprintf(TEXT_DATE_AVAILABLE, zen_date_long($products_date_available)); ?></p>
<?php
}
} else {
if ($flag_show_product_info_date_added == 1) {
?>
<p id="productDateAdded" class="productGeneral centeredContent"><?php echo sprintf(TEXT_DATE_ADDED, zen_date_long($products_date_added)); ?></p>
<?php
} // $flag_show_product_info_date_added
}
?>
<!--eof Product date added/available -->
<!--bof Product URL -->
<?php
if (zen_not_null($products_url)) {
if ($flag_show_product_info_url == 1) {
?>
<p id="productInfoLink" class="productGeneral centeredContent"><?php echo sprintf(TEXT_MORE_INFORMATION, zen_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($products_url), 'NONSSL', true, false)); ?></p>
<?php
} // $flag_show_product_info_url
}
?>
<!--eof Product URL -->
<!--bof also purchased products module-->
<?php require($template->get_template_dir('tpl_modules_also_purchased_products.php', DIR_WS_TEMPLATE, $current_page_base,'templates'). '/' . 'tpl_modules_also_purchased_products.php');?>
<!--eof also purchased products module-->
<!--bof Form close-->
</form>
<!--bof Form close-->
</div>
-
Re: Editing cart contents -- esp products with attributes
Rather than cluttering up the forum with lots of code, it would be more helpful to provide the results that you get using the debug facility that DrByte pointed you towards, as that will often tell us to the specific line that has the problem and an error messgae that says what it is.
-
Re: Editing cart contents -- esp products with attributes
Sorry Kuroi,
I checked out the page Dr. Byte pointed me too but my brain obviously wasn't engaged completely as I forget to upload that utility and try it out...
Here is the output from the debug logging utility:
[09-Nov-2008 11:04:35] PHP Fatal error: Call to undefined method shoppingCart::adjust_quantity() in /xxx/xxx/x/x/x/xxxxxxx/html/includes/extra_cart_actions/edit_cart_item.php on line 63
This is a VERY COOL utility!
I'll dig in and see what I can find...
Gary777
-
Re: Editing cart contents -- esp products with attributes
Apology not needed. I'm glad that it's given you a specific lead to follow-up on. These sorts of problems are always difficult to diagnose without access to the specific files being used, so you are best placed to investigate, but we'll be happy to provide pointers and help as best we can from a distance.
-
Re: Editing cart contents -- esp products with attributes
Hi again,
It now is obvious that the problem is that there appears to be no method "adjust_quantity()" defined that is called from edit_cart_item.php on line 63
I went into the developers toolkit and did a site wide search for this method and it only returned 1 reference, that being of course line 63 of edit_cart_item.php, I then checked the relevant directories in my local hard drive and couldn't find this function either. I tried to trace this backwards but haven't had any luck...
Can someone tell me where the method "adjust_quantity()" should reside?
Thanks,
Gary777
-
Re: Editing cart contents -- esp products with attributes
Hi again all,
I loaded everything up on my local Win XP machine and after a lot of work I got the store reinstalled, I did a fresh download and install of the Edit Cart mod and am getting exactly the same issue... The "adjust_quantity()" method is nowhere to be found.
Any ideas?
Gary777
-
Re: Editing cart contents -- esp products with attributes
Very puzzling. It's the last method declared in the includes/classes/shopping_cart class (core Zen Cart, not the mod). Can't think why it's not presenting in your cart, unless that file has become corrupted.
-
Re: Editing cart contents -- esp products with attributes
Kuroi,
You hit the nail on the head! I downloaded a completely new file set of Zen Cart and checked and sure enough about 30 lines were missing from the bottom of "includes/classes/shopping_cart.php" I replaced that file and re-tested and as far as I can tell all is working well!
Thank you very much for your help!!!
Gary777
-
Re: Editing cart contents -- esp products with attributes
Wow! Thats pretty wild.
I have encoding issues with one of the webhosts I use, and when I use their online file editors, the last couple of lines get truncated or garbled. Perhaps that is how it happened.
Anyway I am glad you got it worked out, and thanks for chipping in Kuroi. As usual, spot on.
-
Re: Editing cart contents -- esp products with attributes
Hi Justin,
Yeah, that was a mind numbing problem... But as usual I learned more about ZC...
I used WS_FTP Pro (and a few others depending on what I want to do) for uploads but I did notice a weird glitch the other day during an upload so I'm thinking the latest version of WS_FTP Pro has a bug...
This is a great mod and it satisfies my client so all is right in the world again! Thank you very much for your help and this mod.
Best regards,
Gary777