SearchRecent postsThe Random ToolboxDrupal 7 Setting up variables for use in a template (preprocess and process functions) Rendering Drupal 7 fields (the right way) Linux Secure Copy (scp) command Restrict Free Shipping in Magento Quickbooks Text Connection Ticket Cross-Site Request Forgery (CSRF) jQuery Events: MouseOver / MouseOut vs. MouseEnter / MouseLeave Monthly archive
|
Custom Add to Cart button on CMS Page in MagentoMagento provides an easy way of adding products to shopping cart via query string. To create a simple add to cart button on any magento’s CMS page open it in WYSIWYG editor and the following HTML to its contents: <button onclick=”location.href =’{{config path=”web/unsecure/base_url”}}/checkout/cart/add?product=1&qty=1′”> Buy It Now</button> Save the page and refresh the cache. Now if you open the page in you should be able to see “Buy It Now” button. When clicked it adds 1 product with ID=1 to your shopping cart. To change the qty of the product to add set qty query string parameter value to desired quantity. Here’s an html sample for adding 5 products at once: |