Jump to content

Can't delete products in block cart


Recommended Posts

Hi,

 

I'm using Prestashop 1.5.4 and I'm unable to delete products in block cart.

 

Here's what I did:

 

1. Removed block cart from hook displayTop

2. Added block cart to hook displayRightColumn

3. Disabled ajax cart from module cart block

 

Looking forward to your help.

 

Thanks.

Link to comment
Share on other sites

Are you used any third party module, url rewriting, or have you changed any core file?

 

Also, can you please post the url you get here? You can leave away the site's name of course, but the query string is important

 

...and, are you using a custom theme?

Edited by Nemo1 (see edit history)
Link to comment
Share on other sites

Thanks Nemo.

 

The configuration is a default one with no modifications what so ever.

 

So if you install version 1.5.4 with default settings/data/theme and do the following:

 

 

1. Unhook block cart from hook displayTop

2. Added block cart to hook displayRightColumn

3. Disabled ajax cart from module cart block

 

I'm unable to delete products from block cart using the 'x' or delete icon.

 

I've decided to switch to AJAX cart, so I'm not too worried about a solution to this problem any more but resolving this bug might be of interest to Prestashop developers and other users.

Link to comment
Share on other sites

  • 5 months later...
  • 3 weeks later...

It's my first post in _this_ topic; but yes, I'm encountering the exact same issue. Ajax cart disabled, one page checkout, clicking [x] on the cart doesn't remove the product.

 

It doesn't work as long as the cart is a 'block' next to other pages. If you view your cart as whole, you can remove products, otherwise, you can't.

Link to comment
Share on other sites

this is how your delete url looks like:

XXXXXXXXX.org/index.php?controller=cart&delete%26id_product%3D12%26ipa%3D0%26id_address_delivery%3D0%26token%3D751116a81b0224e2f435945ae07db56b=

and this is how it should looks like:

XXXXXXXXX.org/index.php?controller=cart&delete=1&id_product=12&ipa=0&id_address_delivery=0&token=751116a81b0224e2f435945ae07db56b

you see the difference?

 

it looks like you've got some troubles with encoding in block cart module template file. If i were you for the first i will check template file encoding type (it must be utf-8 without BOM)

Link to comment
Share on other sites

Hey, thanks for the response. It does indeed look as if the encoding messes up. I've opened up the template file from the theme I'm using and searched for the particular link;

 

<span class="remove_link">{if !isset($customizedDatas.$productId.$productAttributeId) && ($product.total > 0)}<a rel="nofollow" class="ajax_cart_block_remove_link" href="{$link->getPageLink('cart', true, NULL, "delete&id_product={$product.id_product}&ipa={$product.id_product_attribute}&id_address_delivery={$product.id_address_delivery}&token={$static_token}", true)}" title="{l s='remove this product from my cart' mod='blockcart'}" > </a>{/if}</span>

 

I tried adding :'UTF-8' after the {$static_token}" part; but that makes my whole shop render a white page. I'm not quite sure where to edit anything else regarding encoding; I can't find any other encoding aside from UTF-8 here and there. I did notice that all the links to delete an item from my cart use a ajax_cart css style; I've got the ajax cart disabled (on purpose), could this be interfering?

 

Edit: I noticed that the link that does work (when actually viewing cart contents @ index.php?controller=order-opc , and it seems to be 100% the same link; aside from the encoding? Since this is probably using the same code, where the heck would it screw up the encoding?

Edited by Spherix (see edit history)
Link to comment
Share on other sites

can you use:

 

insetead of &

 

just use &

 

in:

{$link->getPageLink('cart', true, NULL, "delete&id_product={$product.id_product}&ipa={$product.id_product_attribute}&id_address_delivery={$product.id_address_delivery}&token={$static_token}", true)}

Link to comment
Share on other sites

Changed all the &'s to &'s, the url still formats as 

index.php?controller=cart&delete%26id_product%3D12%26ipa%3D0%26id_address_delivery%3D0%26token%3D751116a81b0224e2f435945ae07db56b=

From the sidemenu, whilst the cart detail page makes the url
index.php?controller=cart&delete=1&id_product=12&ipa=0&id_address_delivery=0&token=751116a81b0224e2f435945ae07db56b

 

Something if definately screwing up the formatting, but I'm clueless where to look next, as it's using the same code, isn't it?

Link to comment
Share on other sites

Update:

 

I checked the cart pages; it turns out the code for the cart viewing page is different than the one from the module cart-block. I've taken the code from shopping-cart.tpl for the delete link and put it in the module page (blockcart.tpl) and that seems to do the trick. The URL itself is very different though.

 

Old url (blockcart.tpl):

<a rel="nofollow" class="ajax_cart_block_remove_link" href="{$link->getPageLink('cart', true, NULL, "delete&id_product={$product.id_product}&ipa={$product.id_product_attribute}&id_address_delivery={$product.id_address_delivery}&token={$static_token}", true)}" title="{l s='remove this product from my cart' mod='blockcart'}" > </a>

 

New url (from shopping-cart.tpl):

<a rel="nofollow" class="cart_quantity_delete" id="{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "delete&id_product={$product.id_product|intval}&ipa={$product.id_product_attribute|intval}&id_customization={$id_customization}&id_address_delivery={$product.id_address_delivery}&token={$token_cart}")}">{l s='Delete'}</a>

 

By the way... You can't seem to delete free products from a cart; adressed here: http://forge.prestashop.com/browse/PSCFV-10647 as well.

Edited by Spherix (see edit history)
Link to comment
Share on other sites

  • 5 months later...

It's my first post in _this_ topic; but yes, I'm encountering the exact same issue. Ajax cart disabled, one page checkout, clicking [x] on the cart doesn't remove the product.

 

It doesn't work as long as the cart is a 'block' next to other pages. If you view your cart as whole, you can remove products, otherwise, you can't.

 

I have the exact same problem... the issue is on the blockcart only and the ajax should be disabled. I tried to use only & instead of &, I replaced the code from the actual cart page, I reseted the module, I unhooked and re-hooked it from header, nothing works... I think that I have issues with encoding as well but any of the suggested solutions didn't worked out. The version is 1.5.6.2 and the blockcart is edited from a previous dev, which is not responding and we don't know exactly what and how he did... Any help will be highly appreciated as it's quite urgent!

PS: We use the default theme but heavily edited.

PS2: I forgot to mention that when we click on the "delete", currently "X" in our blockcart, we are redirected to the homepage. Also, I don't know if has anything to do with this but we use multiple languages and friendly URLs

Edited by webrise (see edit history)
Link to comment
Share on other sites

  • 4 years later...

I'm having the same issue on PS 1.7.3

I replaced the JS folder (theme/xxx/assets/js) with the classic theme one, and it fixes the cart summary issue but it broke my slider, add to cart JS buttons, and other stuff, of course.

I compared the 2 versions of theme.js (my theme and the originial PS)  as i suspect the ajax update is failing somewhere in it but i really can't find the problem.

If anyone has a little bit of time, that would help a ton, since i'm not good at all in JS !! :)

 

custom-theme.js

theme-original.js

 

by the way, disabling ajax cart didn't do the trick for me.

Edited by R.Shredder (see edit history)
Link to comment
Share on other sites

  • 1 year later...
On 4/8/2013 at 2:54 AM, bpviswa said:

Hi,

 

I'm using Prestashop 1.5.4 and I'm unable to delete products in block cart.

 

Here's what I did:

 

1. Removed block cart from hook displayTop

2. Added block cart to hook displayRightColumn

3. Disabled ajax cart from module cart block

 

Looking forward to your help.

 

Thanks.

first notice the error displayed when you click on remove a product from the shopping cart

if the error is 406 as in the following image solve the problem in the following way otherwise look for solutions with the error shown in the console

image.thumb.png.c5a9add54696719dfb4c355d69cf2d3d.png

1.- enter your Cpanel

image.thumb.png.72d750db46de9c6cca6eeb0e6220f196.png


2.- select mod security
image.thumb.png.7d7f519578ad28fc849924b71057907b.png

3.- Disable domain status

image.thumb.png.7deec67aea24a92595c4b02eca727824.png

Edited by ericksonrqc99 (see edit history)
Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...