Jump to content

change rel="ajax_id_product_XXX" in PS 1.5.6.x


kyrios

Recommended Posts

Default PS 1.5.6.x in Add to Cart button is : 

<a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_XXX" href="URL" title="Add to cart">Add to cart</a>
 

So I wanna change it in order to achieve W3C validation like PS 1.6.x.x

<a class="button ajax_add_to_cart_button btn" href="URL" rel="nofollow" title="Add to cart" data-id-product="XXX"> <span>Add to cart</span> </a>
 

That is code from PS 1.6.x.x, so I wanna change the Add to Cart button URL (of PS 1.5.6.2) like this :

<a class="button ajax_add_to_cart_button exclusive" rel="nofollow" data-fancy="ajax_id_product_XXX" href="url" title="Add to cart">Add to cart</a>
 

I have edited all the necessary *.tpl files correctly. Now need assistance for *.js files adjusment.

 

ajax-cart.js

overrideButtonsInThePage : function(){
//for every 'add' buttons...
$('.ajax_add_to_cart_button').unbind('click').click(function(){
var idProduct =  $(this).attr('rel').replace('nofollow', '').replace('ajax_id_product_', '');
if ($(this).attr('disabled') != 'disabled')
ajaxCart.add(idProduct, null, false, this);
return false;
});
 

Original:

var idProduct =  $(this).attr('rel').replace('nofollow', '').replace('ajax_id_product_', '');
 

to variant 1:

var idProduct =  $(this).attr('data-fancy').replace('nofollow', '').replace('ajax_id_product_', '');
 

to variant 2:

var idProduct =  $(this).attr('data-fancy').replace('ajax_id_product_', '');
 

to variant 3:

var idProduct =  $(this).attr('data-fancy','ajax_id_product_');
 

product-comparison.js

reloadProductComparison = function() {
$('a.cmp_remove').click(function(){
 
var idProduct = $(this).attr('rel').replace('ajax_id_product_', '');
 
$.ajax({
   url: 'index.php?controller=products-comparison&ajax=1&action=remove&id_product=' + idProduct,
  async: false,
  cache: false,
   success: function(){
return true;
}
}); 
});
 

Original

var idProduct = $(this).attr('rel').replace('ajax_id_product_', '');
 

to variant A

var idProduct = $(this).attr('data-fancy').replace('ajax_id_product_', '');
 

to variant B

var idProduct = $(this).attr('data-fancy','ajax_id_product_');
Which ones are correct? Edited by kyrios (see edit history)
Link to comment
Share on other sites

  • 11 months 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...