kyrios Posted July 8, 2014 Share Posted July 8, 2014 (edited) 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 July 8, 2014 by kyrios (see edit history) Link to comment Share on other sites More sharing options...
studionet Posted June 8, 2015 Share Posted June 8, 2015 Hi, u have found correct solution? I do that same like you now Link to comment Share on other sites More sharing options...
kyrios Posted June 8, 2015 Author Share Posted June 8, 2015 ajax-cart.js variant #1 or variant #2 both will work. I do not know the difference between them. product-comparison.js I choose variant #A Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now