How to add remove from cart button onto category pageAdd to Cart button redirects to empty cart on category view pageIssue with implementing Ajax Buy Now button to Magento List.phtmlStop “Please match the requested format: Qty.” from displaying when updating a decimal quantity field in shopping cartRemove Add To Cart Button in product List page magento2 without using template fileHow to Change the position of breadcrumbs in list page?remove Qty option from product add to cart pageRemove Category from Product Page titlewant to replace select button with add to cart button in product listHow to show products from subcategories in a category pageHow to remove default generated canonical tag in category page?

Would dual wielding daggers be a viable choice for a covert bodyguard?

How to know if blackberries are safe to eat

How quality assurance engineers test calculations?

Why weren't bootable game disks ever common on the IBM PC?

How can I effectively communicate to recruiters that a phone call is not possible?

Does Lufthansa weigh your carry on luggage?

Do I have a right to cancel a purchase of foreign currency in the UK?

OR-backed serious games

How do native German speakers usually express skepticism (using even) about a premise?

What is the measurable difference between dry basil and fresh?

Does Multiverse exist in MCU?

Are there any balance issues in allowing two half-feats to be taken without the Ability Score Increase instead of a feat?

Is English unusual in having no second person plural form?

Why didn't Thanos kill all the Dwarves on Nidavellir?

Why did Harry Potter get a bedroom?

How do you move up one folder in Finder?

What is a "shilicashe?"

What does the phrase "head down the rat's hole" mean here?

Why isn't pressure filtration popular compared to vacuum filtration?

How to deal with moral/legal subjects in writing?

The tensor product of two monoidal categories

Why would non-kinetic weapons be used for orbital bombardment?

Is a request to book a business flight ticket for a graduate student an unreasonable one?

Confirming the Identity of a (Friendly) Reviewer After the Reviews



How to add remove from cart button onto category page


Add to Cart button redirects to empty cart on category view pageIssue with implementing Ajax Buy Now button to Magento List.phtmlStop “Please match the requested format: Qty.” from displaying when updating a decimal quantity field in shopping cartRemove Add To Cart Button in product List page magento2 without using template fileHow to Change the position of breadcrumbs in list page?remove Qty option from product add to cart pageRemove Category from Product Page titlewant to replace select button with add to cart button in product listHow to show products from subcategories in a category pageHow to remove default generated canonical tag in category page?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I am currently developing Magento 1.9 (yes I know it's outdated) and they have requested remove from cart buttons on the category page (list.phtml), however, I cannot seem to find a way to add the button.



I have successfully added the button to the page, but can't seem to get the actual like to be correct with the correct data, I believe this to be because I cannot match the quote id to the product id correctly, however it also seems that this gives a much shorter form key than what is normally used by Magento.



$productid = $_product->getId();
<a href="<?php echo $this->getUrl('checkout/cart/delete', array('id' => $productid, Mage_Core_Model_Url::FORM_KEY => $this->_getSingletonModel('core/session')->getFormKey())); ?>">X</a>


Any help would be much appreciated










share|improve this question






























    0















    I am currently developing Magento 1.9 (yes I know it's outdated) and they have requested remove from cart buttons on the category page (list.phtml), however, I cannot seem to find a way to add the button.



    I have successfully added the button to the page, but can't seem to get the actual like to be correct with the correct data, I believe this to be because I cannot match the quote id to the product id correctly, however it also seems that this gives a much shorter form key than what is normally used by Magento.



    $productid = $_product->getId();
    <a href="<?php echo $this->getUrl('checkout/cart/delete', array('id' => $productid, Mage_Core_Model_Url::FORM_KEY => $this->_getSingletonModel('core/session')->getFormKey())); ?>">X</a>


    Any help would be much appreciated










    share|improve this question


























      0












      0








      0








      I am currently developing Magento 1.9 (yes I know it's outdated) and they have requested remove from cart buttons on the category page (list.phtml), however, I cannot seem to find a way to add the button.



      I have successfully added the button to the page, but can't seem to get the actual like to be correct with the correct data, I believe this to be because I cannot match the quote id to the product id correctly, however it also seems that this gives a much shorter form key than what is normally used by Magento.



      $productid = $_product->getId();
      <a href="<?php echo $this->getUrl('checkout/cart/delete', array('id' => $productid, Mage_Core_Model_Url::FORM_KEY => $this->_getSingletonModel('core/session')->getFormKey())); ?>">X</a>


      Any help would be much appreciated










      share|improve this question
















      I am currently developing Magento 1.9 (yes I know it's outdated) and they have requested remove from cart buttons on the category page (list.phtml), however, I cannot seem to find a way to add the button.



      I have successfully added the button to the page, but can't seem to get the actual like to be correct with the correct data, I believe this to be because I cannot match the quote id to the product id correctly, however it also seems that this gives a much shorter form key than what is normally used by Magento.



      $productid = $_product->getId();
      <a href="<?php echo $this->getUrl('checkout/cart/delete', array('id' => $productid, Mage_Core_Model_Url::FORM_KEY => $this->_getSingletonModel('core/session')->getFormKey())); ?>">X</a>


      Any help would be much appreciated







      magento-1.9 category-listing list.phtml






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 2 at 9:16









      poojan sharma

      8511 silver badge10 bronze badges




      8511 silver badge10 bronze badges










      asked Jul 2 at 8:39









      Mage NoobMage Noob

      208 bronze badges




      208 bronze badges




















          1 Answer
          1






          active

          oldest

          votes


















          0














          This could help you.



          Override below file




          /app/design/frontend/rwd/default/template/catalog/product/list.phtml




          Put below code in **<ul class="add-to-links">**

          <?php
          $cart = Mage::getModel('checkout/cart')->getQuote();
          foreach ($cart->getAllItems() as $item)
          $productName = $item->getProduct()->getName();
          if($productName == $_product->getName()) ?>
          <a href="<?= $this->getBaseUrl().'custommodule/index/deleteItem/id/'.$item->getId() ?>" class="link-wishlist"><?php echo $this->__('Remove form cart') ?></a>
          <?php
          ?>


          Now in your custom controller place this function:



          public function deleteItemAction() 
          $cartItemId = $this->getRequest()->getParam('id');
          $cartHelper = Mage::helper('checkout/cart');
          $cartHelper->getCart()->removeItem($cartItemId)->save();
          $this->_redirectReferer();



          I have tested it's working properly.






          share|improve this answer























          • Thank you very much this worked perfectly.

            – Mage Noob
            Jul 2 at 11:08











          • Welcome, Please mark as right answer and also upvote if it helps you. :)

            – Ravi Soni
            Jul 2 at 11:11













          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "479"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f280401%2fhow-to-add-remove-from-cart-button-onto-category-page%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          This could help you.



          Override below file




          /app/design/frontend/rwd/default/template/catalog/product/list.phtml




          Put below code in **<ul class="add-to-links">**

          <?php
          $cart = Mage::getModel('checkout/cart')->getQuote();
          foreach ($cart->getAllItems() as $item)
          $productName = $item->getProduct()->getName();
          if($productName == $_product->getName()) ?>
          <a href="<?= $this->getBaseUrl().'custommodule/index/deleteItem/id/'.$item->getId() ?>" class="link-wishlist"><?php echo $this->__('Remove form cart') ?></a>
          <?php
          ?>


          Now in your custom controller place this function:



          public function deleteItemAction() 
          $cartItemId = $this->getRequest()->getParam('id');
          $cartHelper = Mage::helper('checkout/cart');
          $cartHelper->getCart()->removeItem($cartItemId)->save();
          $this->_redirectReferer();



          I have tested it's working properly.






          share|improve this answer























          • Thank you very much this worked perfectly.

            – Mage Noob
            Jul 2 at 11:08











          • Welcome, Please mark as right answer and also upvote if it helps you. :)

            – Ravi Soni
            Jul 2 at 11:11















          0














          This could help you.



          Override below file




          /app/design/frontend/rwd/default/template/catalog/product/list.phtml




          Put below code in **<ul class="add-to-links">**

          <?php
          $cart = Mage::getModel('checkout/cart')->getQuote();
          foreach ($cart->getAllItems() as $item)
          $productName = $item->getProduct()->getName();
          if($productName == $_product->getName()) ?>
          <a href="<?= $this->getBaseUrl().'custommodule/index/deleteItem/id/'.$item->getId() ?>" class="link-wishlist"><?php echo $this->__('Remove form cart') ?></a>
          <?php
          ?>


          Now in your custom controller place this function:



          public function deleteItemAction() 
          $cartItemId = $this->getRequest()->getParam('id');
          $cartHelper = Mage::helper('checkout/cart');
          $cartHelper->getCart()->removeItem($cartItemId)->save();
          $this->_redirectReferer();



          I have tested it's working properly.






          share|improve this answer























          • Thank you very much this worked perfectly.

            – Mage Noob
            Jul 2 at 11:08











          • Welcome, Please mark as right answer and also upvote if it helps you. :)

            – Ravi Soni
            Jul 2 at 11:11













          0












          0








          0







          This could help you.



          Override below file




          /app/design/frontend/rwd/default/template/catalog/product/list.phtml




          Put below code in **<ul class="add-to-links">**

          <?php
          $cart = Mage::getModel('checkout/cart')->getQuote();
          foreach ($cart->getAllItems() as $item)
          $productName = $item->getProduct()->getName();
          if($productName == $_product->getName()) ?>
          <a href="<?= $this->getBaseUrl().'custommodule/index/deleteItem/id/'.$item->getId() ?>" class="link-wishlist"><?php echo $this->__('Remove form cart') ?></a>
          <?php
          ?>


          Now in your custom controller place this function:



          public function deleteItemAction() 
          $cartItemId = $this->getRequest()->getParam('id');
          $cartHelper = Mage::helper('checkout/cart');
          $cartHelper->getCart()->removeItem($cartItemId)->save();
          $this->_redirectReferer();



          I have tested it's working properly.






          share|improve this answer













          This could help you.



          Override below file




          /app/design/frontend/rwd/default/template/catalog/product/list.phtml




          Put below code in **<ul class="add-to-links">**

          <?php
          $cart = Mage::getModel('checkout/cart')->getQuote();
          foreach ($cart->getAllItems() as $item)
          $productName = $item->getProduct()->getName();
          if($productName == $_product->getName()) ?>
          <a href="<?= $this->getBaseUrl().'custommodule/index/deleteItem/id/'.$item->getId() ?>" class="link-wishlist"><?php echo $this->__('Remove form cart') ?></a>
          <?php
          ?>


          Now in your custom controller place this function:



          public function deleteItemAction() 
          $cartItemId = $this->getRequest()->getParam('id');
          $cartHelper = Mage::helper('checkout/cart');
          $cartHelper->getCart()->removeItem($cartItemId)->save();
          $this->_redirectReferer();



          I have tested it's working properly.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jul 2 at 10:03









          Ravi SoniRavi Soni

          1,0415 silver badges18 bronze badges




          1,0415 silver badges18 bronze badges












          • Thank you very much this worked perfectly.

            – Mage Noob
            Jul 2 at 11:08











          • Welcome, Please mark as right answer and also upvote if it helps you. :)

            – Ravi Soni
            Jul 2 at 11:11

















          • Thank you very much this worked perfectly.

            – Mage Noob
            Jul 2 at 11:08











          • Welcome, Please mark as right answer and also upvote if it helps you. :)

            – Ravi Soni
            Jul 2 at 11:11
















          Thank you very much this worked perfectly.

          – Mage Noob
          Jul 2 at 11:08





          Thank you very much this worked perfectly.

          – Mage Noob
          Jul 2 at 11:08













          Welcome, Please mark as right answer and also upvote if it helps you. :)

          – Ravi Soni
          Jul 2 at 11:11





          Welcome, Please mark as right answer and also upvote if it helps you. :)

          – Ravi Soni
          Jul 2 at 11:11

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f280401%2fhow-to-add-remove-from-cart-button-onto-category-page%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

          Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

          Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form