Jump to content

Prestashop 1.6.1.x + Paypal Module - Vouchers


ANGELO Vintage

Recommended Posts

i've passed many hours try to understand why even if some vouchers are configured they are not appearing during the first of thr 5 phases of checout like other site shown.

At start i thought was a problem of my theme but is based on default-bootstrap 1.6.1.5 version and must be ok.

 

After i've cheked the paypal module and spot that in paypal\views\js\paypal.js there is problem:

 

/* 1.5 One page checkout*/
var qty = $('.qty-field.cart_quantity_input').val();
$('.qty-field.cart_quantity_input').after(qty);
$('.qty-field.cart_quantity_input, .cart_total_bar, .cart_quantity_delete, #cart_voucher *').remove();

So the paypal module Remove the div with the input form for voucher.

if i rename #cart_voucer in #cart_voucher_2 in the js so paypal module cannot remove anymore the area all works ok.

 

it removes also the trashcan icon (.cart_quantity_delete)

 

https://i.gyazo.com/403a9004aaa745a2817f11884d52346b.png

 

 

 

Is possible that this bug is not fixed?

there is another fix without touching the default paypal module?

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

  • 4 months later...

Well, the paypal module (one of the worst modules I've seen) puts inside the prestashop cookie some values before going to paypal (in the last step). If for any reason you don't cancel of finish the paypal checkout , the cookie is still there.

This cookie is what indirectly via javascript does those ugly things on modules\paypal\views\js\paypal.js

{if isset($paypal_authorization)}
	{literal}
	
		/* 1.5 One page checkout*/
		var qty = $('.qty-field.cart_quantity_input').val();
		$('.qty-field.cart_quantity_input').after(qty);
		$('.qty-field.cart_quantity_input, .cart_total_bar, .cart_quantity_delete, #cart_voucher *').remove();
		
		var br = $('.cart > a').prev();
		br.prev().remove();
		br.remove();
		$('.cart.ui-content > a').remove();
		
		var gift_fieldset = $('#gift_div').prev();
		var gift_title = gift_fieldset.prev();
		$('#gift_div, #gift_mobile_div').remove();
		gift_fieldset.remove();
		gift_title.remove();
		
	{/literal}
	{/if}

the best option is delete all this piece of code from modules\paypal\views\js\paypal.js. Probably it has some utility if using the express checkout option in the module configuration but if not ... you can delete it.

Link to comment
Share on other sites

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...