Adds a product to the product comparison list.
Read the
Compare Products Page article for the
implementation details. Usage example:
<a href="#" onclick="return $(this).getForm().sendRequest(
'shop:on_addToCompare', {
onSuccess: function(){alert('The product has been added to the compare list')},
extraFields: {product_id: '<?= $product->id ?>'},
update: {compare_list: 'shop:compare_list'}
});">Add to compare</a>