Adding a Product to the Cart via Querystring using SKUAdding a Product to the Cart via Querystring using SKU in magento 1.9Adding to Cart with Querystring - Takes me to homepage?Adding product SKU into existing Cart Price rule Magento 1.7.0.2Unable to add product in cart with custom option via querystringMultiple Add to Cart Button from External php site using product idAdd product sku in URLHow can I get the product details (like SKU) on JS when “Add to Cart” button is clicked?Add a product to cart in checkout cart page?Why the product button aren't adding into the cart?Issue in adding the product to cart

PTIJ: Do Irish Jews have "the luck of the Irish"?

World War I as a war of liberals against authoritarians?

Question on point set topology

Asserting that Atheism and Theism are both faith based positions

Should I use acronyms in dialogues before telling the readers what it stands for in fiction?

Would it be believable to defy demographics in a story?

What is the term when voters “dishonestly” choose something that they do not want to choose?

Using Past-Perfect interchangeably with the Past Continuous

Does the attack bonus from a Masterwork weapon stack with the attack bonus from Masterwork ammunition?

Generic TVP tradeoffs?

Brake pads destroying wheels

What can I do if I am asked to learn different programming languages very frequently?

What are substitutions for coconut in curry?

What is the relationship between relativity and the Doppler effect?

When did antialiasing start being available?

Print a physical multiplication table

How does 取材で訪れた integrate into this sentence?

In what cases must I use 了 and in what cases not?

Maths symbols and unicode-math input inside siunitx commands

Can a wizard cast a spell during their first turn of combat if they initiated combat by releasing a readied spell?

Light propagating through a sound wave

gerund and noun applications

What (if any) is the reason to buy in small local stores?

Practical application of matrices and determinants



Adding a Product to the Cart via Querystring using SKU


Adding a Product to the Cart via Querystring using SKU in magento 1.9Adding to Cart with Querystring - Takes me to homepage?Adding product SKU into existing Cart Price rule Magento 1.7.0.2Unable to add product in cart with custom option via querystringMultiple Add to Cart Button from External php site using product idAdd product sku in URLHow can I get the product details (like SKU) on JS when “Add to Cart” button is clicked?Add a product to cart in checkout cart page?Why the product button aren't adding into the cart?Issue in adding the product to cart













2















I know that we can adding a product to cart via querystring.

but how do we add sku to cart via querystring in url without including product id
like this :

domain/checkout/cart/add?sku=ABC
or
domain/checkout/cart/add/sku=BC










share|improve this question


























    2















    I know that we can adding a product to cart via querystring.

    but how do we add sku to cart via querystring in url without including product id
    like this :

    domain/checkout/cart/add?sku=ABC
    or
    domain/checkout/cart/add/sku=BC










    share|improve this question
























      2












      2








      2








      I know that we can adding a product to cart via querystring.

      but how do we add sku to cart via querystring in url without including product id
      like this :

      domain/checkout/cart/add?sku=ABC
      or
      domain/checkout/cart/add/sku=BC










      share|improve this question














      I know that we can adding a product to cart via querystring.

      but how do we add sku to cart via querystring in url without including product id
      like this :

      domain/checkout/cart/add?sku=ABC
      or
      domain/checkout/cart/add/sku=BC







      addtocart query sku






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 24 '14 at 3:08









      Andhi IrawanAndhi Irawan

      3771720




      3771720




















          2 Answers
          2






          active

          oldest

          votes


















          2














          Andhi Irawan,you can not do this type of work at checkout Cart controllers. If want this type of work then you need to rewrite Checkout CartController.php and on this class magento is load the product object by id before going to cart,So you need load product by sku on this place .



          Step 1: rewrite cartController.php and code is for xml rewrite



           <frontend>
          <routers>
          <checkout>
          <args>
          <modules>
          <customcart before="Mage_Checkout">YourNameSpace_YourMOdule</customcart>
          </modules>
          </args>
          </checkout>
          </routers>
          </frontend>


          Step2: and on your extended Cartcontorller _initProduct function you need product load product by sku



           protected function _initProduct()

          $sku=$this->getRequest()->setParam('sku');
          $_catalog = Mage::getModel('catalog/product');
          $idBySku = $_catalog->getIdBySku($sku);

          if ($idBySku)
          $productId = $idBySku;
          $this->getRequest()->setParam('product', $productId );
          else
          $productId = (int) $this->getRequest()->getParam('product');

          if ($productId)
          $product = Mage::getModel('catalog/product')
          ->setStoreId(Mage::app()->getStore()->getId())
          ->load($productId);
          if ($product->getId())
          return $product;



          return false;



          How to rewrite controller see more at : http://www.amitbera.com/how-to-override-a-controller-in-magento/






          share|improve this answer

























          • Amit Bera, thank you for your help. i had read your tutorial how to override controller. previous checkout module is apparently already override on the path codelocalABCCheckout. so I do not change the file config.xml. I added a function _initProduct in codelocalABCCheckoutcontrollersCartController.php.The following config.xml file contents:<br/><?xml version="1.0" ?><config><frontend><routers><checkout><args><modules><abc_checkout before="Mage_Checkout">ABC_Checkout</abc_checkout></modules></args></checkout></routers></frontend></config>

            – Andhi Irawan
            Nov 24 '14 at 8:03












          • my appcodelocalABCCheckoutcontrollersCartController.php : pastebin.com/873rBFYm

            – Andhi Irawan
            Nov 24 '14 at 8:56











          • On magenot 1.9 magent is used form key which is validate your cart is proper or not if (!$this->_validateFormKey()) $this->_goBack(); return;

            – Amit Bera
            Nov 24 '14 at 9:04











          • hey,is it resolved or not

            – Amit Bera
            Nov 25 '14 at 7:51











          • hi Amit Bera, sorry I was sick yesterday. my Magento version 1.7. and yes, it resolved. thanks to you and the tutorial you made. i modify the config.xml, function _initProduct() in CartController.php and adding a helper file appcodelocalABCCheckoutHelperCart.php

            – Andhi Irawan
            Nov 27 '14 at 7:10


















          1














          my function _initProduct() : pastebin.com/873rBFYm



          protected function _initProduct()

          $sku = $this->getRequest()->getParam('sku');
          $productId = (int) $this->getRequest()->getParam('product');

          if($sku)
          $params = $this->getRequest()->getParams();
          $productId = Mage::helper('checkout/cart')->getProductIdByParams($params, false);
          if(! $productId)
          return false;



          if ($productId)
          $product = Mage::getModel('catalog/product')
          ->setStoreId(Mage::app()->getStore()->getId())
          ->load($productId);
          if ($product->getId())
          return $product;


          return false;



          my config.xml : pastebin.com/Ks85etyQ



          <?xml version="1.0" ?><config>
          <frontend>
          <routers>
          <checkout>
          <args>
          <modules>
          <abc_checkout before="Mage_Checkout">ABC_Checkout</abc_checkout>
          </modules>
          </args>
          </checkout>
          </routers>
          </frontend><global><helpers>
          <checkout>
          <rewrite>
          <cart>ABC_Checkout_Helper_Cart</cart>
          </rewrite>
          </checkout>
          </helpers></global></config>


          my helper : appcodelocalABCCheckoutHelperCart.php : pastebin.com/RZGSKJdr



          <?php class ABC_Checkout_Helper_Cart extends Mage_Checkout_Helper_Cart
          public function getProductIdByParams($param, $outputFlag = true)
          $sku = trim($param['sku']);
          $_product = Mage::getModel('catalog/product')->setStoreId(Mage::app()->getStore()->getId())
          ->loadByAttribute('sku', $sku);

          if($_product)
          $productTypeId = $_product->getTypeId();
          $productId = $_product->getId();
          if($productTypeId == 'simple')
          $result = $outputFlag ? true : $productId;

          elseif($productTypeId == 'configurable')
          $color = trim($param['color']);
          $size = trim($param['size']);
          $config = trim($param['option']);

          $configurableProduct = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
          $simpleCollections = $configurableProduct->getUsedProductCollection()
          ->addAttributeToSelect('id');
          if(! empty($color))
          $attrColor = $_product->getResource()->getAttribute("sp_color");
          $colorId = $attrColor->usesSource() ? $attrColor->getSource()->getOptionId($color) : '';
          $simpleCollections->addAttributeToFilter('sp_color', $colorId);

          if(! empty($size))
          $attrSize = $_product->getResource()->getAttribute("sp_size");
          $sizeId = $attrSize->usesSource() ? $attrSize->getSource()->getOptionId($size) : '';
          $simpleCollections->addAttributeToFilter('sp_size', $sizeId);

          if(! empty($config))
          $attrConfig = $_product->getResource()->getAttribute("sp_config");
          $configId = $attrConfig->usesSource() ? $attrConfig->getSource()->getOptionId($config) : '';
          $simpleCollections->addAttributeToFilter('sp_config', $configId);

          $simpleCollections->addFilterByRequiredOptions();

          if($simpleCollections->count() == 1)
          $productId = $simpleCollections->getFirstItem()->getId();
          $result = $outputFlag ? true : $productId;

          else
          $result = false;



          return $result;

          return false;



          so sku can be adding via url querystring like this :



          SIMPLE PRODUCT



          Parameter:<br/>
          ~ sku<br/>
          ~ qty<br/>


          a. Add product with qty = 1



          domain/id/index.php/checkout/cart/add/sku/ABCD<br/>
          or<br/>
          domain/id/index.php/checkout/cart/add?sku=ABCD


          b. Add product with qty more than 1



          domain/id/index.php/checkout/cart/add/sku/ABCD/qty/3<br/>
          or<br/>
          domain/id/index.php/checkout/cart/add?sku=ABCD&qty=3<br/>

          CONFIGURABLE PRODUCT<br/>
          Parameter:<br/>
          ~ sku<br/>
          ~ color<br/>
          ~ size<br/>
          ~ option (ex: used by XYZ)<br/>
          ~ qty<br/>
          ~ __store (id or en)<br/>


          a. Add product with qty = 1



          domain/id/index.php/checkout/cart/add/sku/XYZ/color/merah tua/size/M/__store/id<br/>
          domain/id/index.php/checkout/cart/add/sku/XYZ/color/maroon/size/M/__store/en<br/>
          domain/id/index.php/checkout/cart/add/sku/XYZ/option/bilqis/__store/id<br/>
          or<br/>
          domain/id/index.php/checkout/cart/add?sku=XYZ&color=merah tua&size=M&__store=id<br/>
          domain/id/index.php/checkout/cart/add?sku=XYZ&color=maroon&size=M&__store=en<br/>
          domain/id/index.php/checkout/cart/add?sku=XYZ&option=bilqis&__store=id<br/>


          b. Add product with qty more than 1



          domain/id/index.php/checkout/cart/add/sku/XYZ/color/merah tua/size/M/qty/3/__store/id<br/>
          domain/id/index.php/checkout/cart/add/sku/XYZ/color/maroon/size/M/qty/3/__store/en<br/>
          domain/id/index.php/checkout/cart/add/sku/XYZ/option/bilqis/qty/3/__store/id<br/>
          or<br/>
          domain/id/index.php/checkout/cart/add?sku=XYZ&color=merah tua&size=M&qty=3&__store=id<br/>
          domain/id/index.php/checkout/cart/add?sku=XYZ&color=maroon&size=M&qty=3&__store=en<br/>
          domain/id/index.php/checkout/cart/add?sku=XYZ&option=bilqis&qty=3&__store=id





          share|improve this answer
























            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%2f45132%2fadding-a-product-to-the-cart-via-querystring-using-sku%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            Andhi Irawan,you can not do this type of work at checkout Cart controllers. If want this type of work then you need to rewrite Checkout CartController.php and on this class magento is load the product object by id before going to cart,So you need load product by sku on this place .



            Step 1: rewrite cartController.php and code is for xml rewrite



             <frontend>
            <routers>
            <checkout>
            <args>
            <modules>
            <customcart before="Mage_Checkout">YourNameSpace_YourMOdule</customcart>
            </modules>
            </args>
            </checkout>
            </routers>
            </frontend>


            Step2: and on your extended Cartcontorller _initProduct function you need product load product by sku



             protected function _initProduct()

            $sku=$this->getRequest()->setParam('sku');
            $_catalog = Mage::getModel('catalog/product');
            $idBySku = $_catalog->getIdBySku($sku);

            if ($idBySku)
            $productId = $idBySku;
            $this->getRequest()->setParam('product', $productId );
            else
            $productId = (int) $this->getRequest()->getParam('product');

            if ($productId)
            $product = Mage::getModel('catalog/product')
            ->setStoreId(Mage::app()->getStore()->getId())
            ->load($productId);
            if ($product->getId())
            return $product;



            return false;



            How to rewrite controller see more at : http://www.amitbera.com/how-to-override-a-controller-in-magento/






            share|improve this answer

























            • Amit Bera, thank you for your help. i had read your tutorial how to override controller. previous checkout module is apparently already override on the path codelocalABCCheckout. so I do not change the file config.xml. I added a function _initProduct in codelocalABCCheckoutcontrollersCartController.php.The following config.xml file contents:<br/><?xml version="1.0" ?><config><frontend><routers><checkout><args><modules><abc_checkout before="Mage_Checkout">ABC_Checkout</abc_checkout></modules></args></checkout></routers></frontend></config>

              – Andhi Irawan
              Nov 24 '14 at 8:03












            • my appcodelocalABCCheckoutcontrollersCartController.php : pastebin.com/873rBFYm

              – Andhi Irawan
              Nov 24 '14 at 8:56











            • On magenot 1.9 magent is used form key which is validate your cart is proper or not if (!$this->_validateFormKey()) $this->_goBack(); return;

              – Amit Bera
              Nov 24 '14 at 9:04











            • hey,is it resolved or not

              – Amit Bera
              Nov 25 '14 at 7:51











            • hi Amit Bera, sorry I was sick yesterday. my Magento version 1.7. and yes, it resolved. thanks to you and the tutorial you made. i modify the config.xml, function _initProduct() in CartController.php and adding a helper file appcodelocalABCCheckoutHelperCart.php

              – Andhi Irawan
              Nov 27 '14 at 7:10















            2














            Andhi Irawan,you can not do this type of work at checkout Cart controllers. If want this type of work then you need to rewrite Checkout CartController.php and on this class magento is load the product object by id before going to cart,So you need load product by sku on this place .



            Step 1: rewrite cartController.php and code is for xml rewrite



             <frontend>
            <routers>
            <checkout>
            <args>
            <modules>
            <customcart before="Mage_Checkout">YourNameSpace_YourMOdule</customcart>
            </modules>
            </args>
            </checkout>
            </routers>
            </frontend>


            Step2: and on your extended Cartcontorller _initProduct function you need product load product by sku



             protected function _initProduct()

            $sku=$this->getRequest()->setParam('sku');
            $_catalog = Mage::getModel('catalog/product');
            $idBySku = $_catalog->getIdBySku($sku);

            if ($idBySku)
            $productId = $idBySku;
            $this->getRequest()->setParam('product', $productId );
            else
            $productId = (int) $this->getRequest()->getParam('product');

            if ($productId)
            $product = Mage::getModel('catalog/product')
            ->setStoreId(Mage::app()->getStore()->getId())
            ->load($productId);
            if ($product->getId())
            return $product;



            return false;



            How to rewrite controller see more at : http://www.amitbera.com/how-to-override-a-controller-in-magento/






            share|improve this answer

























            • Amit Bera, thank you for your help. i had read your tutorial how to override controller. previous checkout module is apparently already override on the path codelocalABCCheckout. so I do not change the file config.xml. I added a function _initProduct in codelocalABCCheckoutcontrollersCartController.php.The following config.xml file contents:<br/><?xml version="1.0" ?><config><frontend><routers><checkout><args><modules><abc_checkout before="Mage_Checkout">ABC_Checkout</abc_checkout></modules></args></checkout></routers></frontend></config>

              – Andhi Irawan
              Nov 24 '14 at 8:03












            • my appcodelocalABCCheckoutcontrollersCartController.php : pastebin.com/873rBFYm

              – Andhi Irawan
              Nov 24 '14 at 8:56











            • On magenot 1.9 magent is used form key which is validate your cart is proper or not if (!$this->_validateFormKey()) $this->_goBack(); return;

              – Amit Bera
              Nov 24 '14 at 9:04











            • hey,is it resolved or not

              – Amit Bera
              Nov 25 '14 at 7:51











            • hi Amit Bera, sorry I was sick yesterday. my Magento version 1.7. and yes, it resolved. thanks to you and the tutorial you made. i modify the config.xml, function _initProduct() in CartController.php and adding a helper file appcodelocalABCCheckoutHelperCart.php

              – Andhi Irawan
              Nov 27 '14 at 7:10













            2












            2








            2







            Andhi Irawan,you can not do this type of work at checkout Cart controllers. If want this type of work then you need to rewrite Checkout CartController.php and on this class magento is load the product object by id before going to cart,So you need load product by sku on this place .



            Step 1: rewrite cartController.php and code is for xml rewrite



             <frontend>
            <routers>
            <checkout>
            <args>
            <modules>
            <customcart before="Mage_Checkout">YourNameSpace_YourMOdule</customcart>
            </modules>
            </args>
            </checkout>
            </routers>
            </frontend>


            Step2: and on your extended Cartcontorller _initProduct function you need product load product by sku



             protected function _initProduct()

            $sku=$this->getRequest()->setParam('sku');
            $_catalog = Mage::getModel('catalog/product');
            $idBySku = $_catalog->getIdBySku($sku);

            if ($idBySku)
            $productId = $idBySku;
            $this->getRequest()->setParam('product', $productId );
            else
            $productId = (int) $this->getRequest()->getParam('product');

            if ($productId)
            $product = Mage::getModel('catalog/product')
            ->setStoreId(Mage::app()->getStore()->getId())
            ->load($productId);
            if ($product->getId())
            return $product;



            return false;



            How to rewrite controller see more at : http://www.amitbera.com/how-to-override-a-controller-in-magento/






            share|improve this answer















            Andhi Irawan,you can not do this type of work at checkout Cart controllers. If want this type of work then you need to rewrite Checkout CartController.php and on this class magento is load the product object by id before going to cart,So you need load product by sku on this place .



            Step 1: rewrite cartController.php and code is for xml rewrite



             <frontend>
            <routers>
            <checkout>
            <args>
            <modules>
            <customcart before="Mage_Checkout">YourNameSpace_YourMOdule</customcart>
            </modules>
            </args>
            </checkout>
            </routers>
            </frontend>


            Step2: and on your extended Cartcontorller _initProduct function you need product load product by sku



             protected function _initProduct()

            $sku=$this->getRequest()->setParam('sku');
            $_catalog = Mage::getModel('catalog/product');
            $idBySku = $_catalog->getIdBySku($sku);

            if ($idBySku)
            $productId = $idBySku;
            $this->getRequest()->setParam('product', $productId );
            else
            $productId = (int) $this->getRequest()->getParam('product');

            if ($productId)
            $product = Mage::getModel('catalog/product')
            ->setStoreId(Mage::app()->getStore()->getId())
            ->load($productId);
            if ($product->getId())
            return $product;



            return false;



            How to rewrite controller see more at : http://www.amitbera.com/how-to-override-a-controller-in-magento/







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 24 '14 at 5:22

























            answered Nov 24 '14 at 4:41









            Amit BeraAmit Bera

            59.2k1575176




            59.2k1575176












            • Amit Bera, thank you for your help. i had read your tutorial how to override controller. previous checkout module is apparently already override on the path codelocalABCCheckout. so I do not change the file config.xml. I added a function _initProduct in codelocalABCCheckoutcontrollersCartController.php.The following config.xml file contents:<br/><?xml version="1.0" ?><config><frontend><routers><checkout><args><modules><abc_checkout before="Mage_Checkout">ABC_Checkout</abc_checkout></modules></args></checkout></routers></frontend></config>

              – Andhi Irawan
              Nov 24 '14 at 8:03












            • my appcodelocalABCCheckoutcontrollersCartController.php : pastebin.com/873rBFYm

              – Andhi Irawan
              Nov 24 '14 at 8:56











            • On magenot 1.9 magent is used form key which is validate your cart is proper or not if (!$this->_validateFormKey()) $this->_goBack(); return;

              – Amit Bera
              Nov 24 '14 at 9:04











            • hey,is it resolved or not

              – Amit Bera
              Nov 25 '14 at 7:51











            • hi Amit Bera, sorry I was sick yesterday. my Magento version 1.7. and yes, it resolved. thanks to you and the tutorial you made. i modify the config.xml, function _initProduct() in CartController.php and adding a helper file appcodelocalABCCheckoutHelperCart.php

              – Andhi Irawan
              Nov 27 '14 at 7:10

















            • Amit Bera, thank you for your help. i had read your tutorial how to override controller. previous checkout module is apparently already override on the path codelocalABCCheckout. so I do not change the file config.xml. I added a function _initProduct in codelocalABCCheckoutcontrollersCartController.php.The following config.xml file contents:<br/><?xml version="1.0" ?><config><frontend><routers><checkout><args><modules><abc_checkout before="Mage_Checkout">ABC_Checkout</abc_checkout></modules></args></checkout></routers></frontend></config>

              – Andhi Irawan
              Nov 24 '14 at 8:03












            • my appcodelocalABCCheckoutcontrollersCartController.php : pastebin.com/873rBFYm

              – Andhi Irawan
              Nov 24 '14 at 8:56











            • On magenot 1.9 magent is used form key which is validate your cart is proper or not if (!$this->_validateFormKey()) $this->_goBack(); return;

              – Amit Bera
              Nov 24 '14 at 9:04











            • hey,is it resolved or not

              – Amit Bera
              Nov 25 '14 at 7:51











            • hi Amit Bera, sorry I was sick yesterday. my Magento version 1.7. and yes, it resolved. thanks to you and the tutorial you made. i modify the config.xml, function _initProduct() in CartController.php and adding a helper file appcodelocalABCCheckoutHelperCart.php

              – Andhi Irawan
              Nov 27 '14 at 7:10
















            Amit Bera, thank you for your help. i had read your tutorial how to override controller. previous checkout module is apparently already override on the path codelocalABCCheckout. so I do not change the file config.xml. I added a function _initProduct in codelocalABCCheckoutcontrollersCartController.php.The following config.xml file contents:<br/><?xml version="1.0" ?><config><frontend><routers><checkout><args><modules><abc_checkout before="Mage_Checkout">ABC_Checkout</abc_checkout></modules></args></checkout></routers></frontend></config>

            – Andhi Irawan
            Nov 24 '14 at 8:03






            Amit Bera, thank you for your help. i had read your tutorial how to override controller. previous checkout module is apparently already override on the path codelocalABCCheckout. so I do not change the file config.xml. I added a function _initProduct in codelocalABCCheckoutcontrollersCartController.php.The following config.xml file contents:<br/><?xml version="1.0" ?><config><frontend><routers><checkout><args><modules><abc_checkout before="Mage_Checkout">ABC_Checkout</abc_checkout></modules></args></checkout></routers></frontend></config>

            – Andhi Irawan
            Nov 24 '14 at 8:03














            my appcodelocalABCCheckoutcontrollersCartController.php : pastebin.com/873rBFYm

            – Andhi Irawan
            Nov 24 '14 at 8:56





            my appcodelocalABCCheckoutcontrollersCartController.php : pastebin.com/873rBFYm

            – Andhi Irawan
            Nov 24 '14 at 8:56













            On magenot 1.9 magent is used form key which is validate your cart is proper or not if (!$this->_validateFormKey()) $this->_goBack(); return;

            – Amit Bera
            Nov 24 '14 at 9:04





            On magenot 1.9 magent is used form key which is validate your cart is proper or not if (!$this->_validateFormKey()) $this->_goBack(); return;

            – Amit Bera
            Nov 24 '14 at 9:04













            hey,is it resolved or not

            – Amit Bera
            Nov 25 '14 at 7:51





            hey,is it resolved or not

            – Amit Bera
            Nov 25 '14 at 7:51













            hi Amit Bera, sorry I was sick yesterday. my Magento version 1.7. and yes, it resolved. thanks to you and the tutorial you made. i modify the config.xml, function _initProduct() in CartController.php and adding a helper file appcodelocalABCCheckoutHelperCart.php

            – Andhi Irawan
            Nov 27 '14 at 7:10





            hi Amit Bera, sorry I was sick yesterday. my Magento version 1.7. and yes, it resolved. thanks to you and the tutorial you made. i modify the config.xml, function _initProduct() in CartController.php and adding a helper file appcodelocalABCCheckoutHelperCart.php

            – Andhi Irawan
            Nov 27 '14 at 7:10













            1














            my function _initProduct() : pastebin.com/873rBFYm



            protected function _initProduct()

            $sku = $this->getRequest()->getParam('sku');
            $productId = (int) $this->getRequest()->getParam('product');

            if($sku)
            $params = $this->getRequest()->getParams();
            $productId = Mage::helper('checkout/cart')->getProductIdByParams($params, false);
            if(! $productId)
            return false;



            if ($productId)
            $product = Mage::getModel('catalog/product')
            ->setStoreId(Mage::app()->getStore()->getId())
            ->load($productId);
            if ($product->getId())
            return $product;


            return false;



            my config.xml : pastebin.com/Ks85etyQ



            <?xml version="1.0" ?><config>
            <frontend>
            <routers>
            <checkout>
            <args>
            <modules>
            <abc_checkout before="Mage_Checkout">ABC_Checkout</abc_checkout>
            </modules>
            </args>
            </checkout>
            </routers>
            </frontend><global><helpers>
            <checkout>
            <rewrite>
            <cart>ABC_Checkout_Helper_Cart</cart>
            </rewrite>
            </checkout>
            </helpers></global></config>


            my helper : appcodelocalABCCheckoutHelperCart.php : pastebin.com/RZGSKJdr



            <?php class ABC_Checkout_Helper_Cart extends Mage_Checkout_Helper_Cart
            public function getProductIdByParams($param, $outputFlag = true)
            $sku = trim($param['sku']);
            $_product = Mage::getModel('catalog/product')->setStoreId(Mage::app()->getStore()->getId())
            ->loadByAttribute('sku', $sku);

            if($_product)
            $productTypeId = $_product->getTypeId();
            $productId = $_product->getId();
            if($productTypeId == 'simple')
            $result = $outputFlag ? true : $productId;

            elseif($productTypeId == 'configurable')
            $color = trim($param['color']);
            $size = trim($param['size']);
            $config = trim($param['option']);

            $configurableProduct = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
            $simpleCollections = $configurableProduct->getUsedProductCollection()
            ->addAttributeToSelect('id');
            if(! empty($color))
            $attrColor = $_product->getResource()->getAttribute("sp_color");
            $colorId = $attrColor->usesSource() ? $attrColor->getSource()->getOptionId($color) : '';
            $simpleCollections->addAttributeToFilter('sp_color', $colorId);

            if(! empty($size))
            $attrSize = $_product->getResource()->getAttribute("sp_size");
            $sizeId = $attrSize->usesSource() ? $attrSize->getSource()->getOptionId($size) : '';
            $simpleCollections->addAttributeToFilter('sp_size', $sizeId);

            if(! empty($config))
            $attrConfig = $_product->getResource()->getAttribute("sp_config");
            $configId = $attrConfig->usesSource() ? $attrConfig->getSource()->getOptionId($config) : '';
            $simpleCollections->addAttributeToFilter('sp_config', $configId);

            $simpleCollections->addFilterByRequiredOptions();

            if($simpleCollections->count() == 1)
            $productId = $simpleCollections->getFirstItem()->getId();
            $result = $outputFlag ? true : $productId;

            else
            $result = false;



            return $result;

            return false;



            so sku can be adding via url querystring like this :



            SIMPLE PRODUCT



            Parameter:<br/>
            ~ sku<br/>
            ~ qty<br/>


            a. Add product with qty = 1



            domain/id/index.php/checkout/cart/add/sku/ABCD<br/>
            or<br/>
            domain/id/index.php/checkout/cart/add?sku=ABCD


            b. Add product with qty more than 1



            domain/id/index.php/checkout/cart/add/sku/ABCD/qty/3<br/>
            or<br/>
            domain/id/index.php/checkout/cart/add?sku=ABCD&qty=3<br/>

            CONFIGURABLE PRODUCT<br/>
            Parameter:<br/>
            ~ sku<br/>
            ~ color<br/>
            ~ size<br/>
            ~ option (ex: used by XYZ)<br/>
            ~ qty<br/>
            ~ __store (id or en)<br/>


            a. Add product with qty = 1



            domain/id/index.php/checkout/cart/add/sku/XYZ/color/merah tua/size/M/__store/id<br/>
            domain/id/index.php/checkout/cart/add/sku/XYZ/color/maroon/size/M/__store/en<br/>
            domain/id/index.php/checkout/cart/add/sku/XYZ/option/bilqis/__store/id<br/>
            or<br/>
            domain/id/index.php/checkout/cart/add?sku=XYZ&color=merah tua&size=M&__store=id<br/>
            domain/id/index.php/checkout/cart/add?sku=XYZ&color=maroon&size=M&__store=en<br/>
            domain/id/index.php/checkout/cart/add?sku=XYZ&option=bilqis&__store=id<br/>


            b. Add product with qty more than 1



            domain/id/index.php/checkout/cart/add/sku/XYZ/color/merah tua/size/M/qty/3/__store/id<br/>
            domain/id/index.php/checkout/cart/add/sku/XYZ/color/maroon/size/M/qty/3/__store/en<br/>
            domain/id/index.php/checkout/cart/add/sku/XYZ/option/bilqis/qty/3/__store/id<br/>
            or<br/>
            domain/id/index.php/checkout/cart/add?sku=XYZ&color=merah tua&size=M&qty=3&__store=id<br/>
            domain/id/index.php/checkout/cart/add?sku=XYZ&color=maroon&size=M&qty=3&__store=en<br/>
            domain/id/index.php/checkout/cart/add?sku=XYZ&option=bilqis&qty=3&__store=id





            share|improve this answer





























              1














              my function _initProduct() : pastebin.com/873rBFYm



              protected function _initProduct()

              $sku = $this->getRequest()->getParam('sku');
              $productId = (int) $this->getRequest()->getParam('product');

              if($sku)
              $params = $this->getRequest()->getParams();
              $productId = Mage::helper('checkout/cart')->getProductIdByParams($params, false);
              if(! $productId)
              return false;



              if ($productId)
              $product = Mage::getModel('catalog/product')
              ->setStoreId(Mage::app()->getStore()->getId())
              ->load($productId);
              if ($product->getId())
              return $product;


              return false;



              my config.xml : pastebin.com/Ks85etyQ



              <?xml version="1.0" ?><config>
              <frontend>
              <routers>
              <checkout>
              <args>
              <modules>
              <abc_checkout before="Mage_Checkout">ABC_Checkout</abc_checkout>
              </modules>
              </args>
              </checkout>
              </routers>
              </frontend><global><helpers>
              <checkout>
              <rewrite>
              <cart>ABC_Checkout_Helper_Cart</cart>
              </rewrite>
              </checkout>
              </helpers></global></config>


              my helper : appcodelocalABCCheckoutHelperCart.php : pastebin.com/RZGSKJdr



              <?php class ABC_Checkout_Helper_Cart extends Mage_Checkout_Helper_Cart
              public function getProductIdByParams($param, $outputFlag = true)
              $sku = trim($param['sku']);
              $_product = Mage::getModel('catalog/product')->setStoreId(Mage::app()->getStore()->getId())
              ->loadByAttribute('sku', $sku);

              if($_product)
              $productTypeId = $_product->getTypeId();
              $productId = $_product->getId();
              if($productTypeId == 'simple')
              $result = $outputFlag ? true : $productId;

              elseif($productTypeId == 'configurable')
              $color = trim($param['color']);
              $size = trim($param['size']);
              $config = trim($param['option']);

              $configurableProduct = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
              $simpleCollections = $configurableProduct->getUsedProductCollection()
              ->addAttributeToSelect('id');
              if(! empty($color))
              $attrColor = $_product->getResource()->getAttribute("sp_color");
              $colorId = $attrColor->usesSource() ? $attrColor->getSource()->getOptionId($color) : '';
              $simpleCollections->addAttributeToFilter('sp_color', $colorId);

              if(! empty($size))
              $attrSize = $_product->getResource()->getAttribute("sp_size");
              $sizeId = $attrSize->usesSource() ? $attrSize->getSource()->getOptionId($size) : '';
              $simpleCollections->addAttributeToFilter('sp_size', $sizeId);

              if(! empty($config))
              $attrConfig = $_product->getResource()->getAttribute("sp_config");
              $configId = $attrConfig->usesSource() ? $attrConfig->getSource()->getOptionId($config) : '';
              $simpleCollections->addAttributeToFilter('sp_config', $configId);

              $simpleCollections->addFilterByRequiredOptions();

              if($simpleCollections->count() == 1)
              $productId = $simpleCollections->getFirstItem()->getId();
              $result = $outputFlag ? true : $productId;

              else
              $result = false;



              return $result;

              return false;



              so sku can be adding via url querystring like this :



              SIMPLE PRODUCT



              Parameter:<br/>
              ~ sku<br/>
              ~ qty<br/>


              a. Add product with qty = 1



              domain/id/index.php/checkout/cart/add/sku/ABCD<br/>
              or<br/>
              domain/id/index.php/checkout/cart/add?sku=ABCD


              b. Add product with qty more than 1



              domain/id/index.php/checkout/cart/add/sku/ABCD/qty/3<br/>
              or<br/>
              domain/id/index.php/checkout/cart/add?sku=ABCD&qty=3<br/>

              CONFIGURABLE PRODUCT<br/>
              Parameter:<br/>
              ~ sku<br/>
              ~ color<br/>
              ~ size<br/>
              ~ option (ex: used by XYZ)<br/>
              ~ qty<br/>
              ~ __store (id or en)<br/>


              a. Add product with qty = 1



              domain/id/index.php/checkout/cart/add/sku/XYZ/color/merah tua/size/M/__store/id<br/>
              domain/id/index.php/checkout/cart/add/sku/XYZ/color/maroon/size/M/__store/en<br/>
              domain/id/index.php/checkout/cart/add/sku/XYZ/option/bilqis/__store/id<br/>
              or<br/>
              domain/id/index.php/checkout/cart/add?sku=XYZ&color=merah tua&size=M&__store=id<br/>
              domain/id/index.php/checkout/cart/add?sku=XYZ&color=maroon&size=M&__store=en<br/>
              domain/id/index.php/checkout/cart/add?sku=XYZ&option=bilqis&__store=id<br/>


              b. Add product with qty more than 1



              domain/id/index.php/checkout/cart/add/sku/XYZ/color/merah tua/size/M/qty/3/__store/id<br/>
              domain/id/index.php/checkout/cart/add/sku/XYZ/color/maroon/size/M/qty/3/__store/en<br/>
              domain/id/index.php/checkout/cart/add/sku/XYZ/option/bilqis/qty/3/__store/id<br/>
              or<br/>
              domain/id/index.php/checkout/cart/add?sku=XYZ&color=merah tua&size=M&qty=3&__store=id<br/>
              domain/id/index.php/checkout/cart/add?sku=XYZ&color=maroon&size=M&qty=3&__store=en<br/>
              domain/id/index.php/checkout/cart/add?sku=XYZ&option=bilqis&qty=3&__store=id





              share|improve this answer



























                1












                1








                1







                my function _initProduct() : pastebin.com/873rBFYm



                protected function _initProduct()

                $sku = $this->getRequest()->getParam('sku');
                $productId = (int) $this->getRequest()->getParam('product');

                if($sku)
                $params = $this->getRequest()->getParams();
                $productId = Mage::helper('checkout/cart')->getProductIdByParams($params, false);
                if(! $productId)
                return false;



                if ($productId)
                $product = Mage::getModel('catalog/product')
                ->setStoreId(Mage::app()->getStore()->getId())
                ->load($productId);
                if ($product->getId())
                return $product;


                return false;



                my config.xml : pastebin.com/Ks85etyQ



                <?xml version="1.0" ?><config>
                <frontend>
                <routers>
                <checkout>
                <args>
                <modules>
                <abc_checkout before="Mage_Checkout">ABC_Checkout</abc_checkout>
                </modules>
                </args>
                </checkout>
                </routers>
                </frontend><global><helpers>
                <checkout>
                <rewrite>
                <cart>ABC_Checkout_Helper_Cart</cart>
                </rewrite>
                </checkout>
                </helpers></global></config>


                my helper : appcodelocalABCCheckoutHelperCart.php : pastebin.com/RZGSKJdr



                <?php class ABC_Checkout_Helper_Cart extends Mage_Checkout_Helper_Cart
                public function getProductIdByParams($param, $outputFlag = true)
                $sku = trim($param['sku']);
                $_product = Mage::getModel('catalog/product')->setStoreId(Mage::app()->getStore()->getId())
                ->loadByAttribute('sku', $sku);

                if($_product)
                $productTypeId = $_product->getTypeId();
                $productId = $_product->getId();
                if($productTypeId == 'simple')
                $result = $outputFlag ? true : $productId;

                elseif($productTypeId == 'configurable')
                $color = trim($param['color']);
                $size = trim($param['size']);
                $config = trim($param['option']);

                $configurableProduct = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
                $simpleCollections = $configurableProduct->getUsedProductCollection()
                ->addAttributeToSelect('id');
                if(! empty($color))
                $attrColor = $_product->getResource()->getAttribute("sp_color");
                $colorId = $attrColor->usesSource() ? $attrColor->getSource()->getOptionId($color) : '';
                $simpleCollections->addAttributeToFilter('sp_color', $colorId);

                if(! empty($size))
                $attrSize = $_product->getResource()->getAttribute("sp_size");
                $sizeId = $attrSize->usesSource() ? $attrSize->getSource()->getOptionId($size) : '';
                $simpleCollections->addAttributeToFilter('sp_size', $sizeId);

                if(! empty($config))
                $attrConfig = $_product->getResource()->getAttribute("sp_config");
                $configId = $attrConfig->usesSource() ? $attrConfig->getSource()->getOptionId($config) : '';
                $simpleCollections->addAttributeToFilter('sp_config', $configId);

                $simpleCollections->addFilterByRequiredOptions();

                if($simpleCollections->count() == 1)
                $productId = $simpleCollections->getFirstItem()->getId();
                $result = $outputFlag ? true : $productId;

                else
                $result = false;



                return $result;

                return false;



                so sku can be adding via url querystring like this :



                SIMPLE PRODUCT



                Parameter:<br/>
                ~ sku<br/>
                ~ qty<br/>


                a. Add product with qty = 1



                domain/id/index.php/checkout/cart/add/sku/ABCD<br/>
                or<br/>
                domain/id/index.php/checkout/cart/add?sku=ABCD


                b. Add product with qty more than 1



                domain/id/index.php/checkout/cart/add/sku/ABCD/qty/3<br/>
                or<br/>
                domain/id/index.php/checkout/cart/add?sku=ABCD&qty=3<br/>

                CONFIGURABLE PRODUCT<br/>
                Parameter:<br/>
                ~ sku<br/>
                ~ color<br/>
                ~ size<br/>
                ~ option (ex: used by XYZ)<br/>
                ~ qty<br/>
                ~ __store (id or en)<br/>


                a. Add product with qty = 1



                domain/id/index.php/checkout/cart/add/sku/XYZ/color/merah tua/size/M/__store/id<br/>
                domain/id/index.php/checkout/cart/add/sku/XYZ/color/maroon/size/M/__store/en<br/>
                domain/id/index.php/checkout/cart/add/sku/XYZ/option/bilqis/__store/id<br/>
                or<br/>
                domain/id/index.php/checkout/cart/add?sku=XYZ&color=merah tua&size=M&__store=id<br/>
                domain/id/index.php/checkout/cart/add?sku=XYZ&color=maroon&size=M&__store=en<br/>
                domain/id/index.php/checkout/cart/add?sku=XYZ&option=bilqis&__store=id<br/>


                b. Add product with qty more than 1



                domain/id/index.php/checkout/cart/add/sku/XYZ/color/merah tua/size/M/qty/3/__store/id<br/>
                domain/id/index.php/checkout/cart/add/sku/XYZ/color/maroon/size/M/qty/3/__store/en<br/>
                domain/id/index.php/checkout/cart/add/sku/XYZ/option/bilqis/qty/3/__store/id<br/>
                or<br/>
                domain/id/index.php/checkout/cart/add?sku=XYZ&color=merah tua&size=M&qty=3&__store=id<br/>
                domain/id/index.php/checkout/cart/add?sku=XYZ&color=maroon&size=M&qty=3&__store=en<br/>
                domain/id/index.php/checkout/cart/add?sku=XYZ&option=bilqis&qty=3&__store=id





                share|improve this answer















                my function _initProduct() : pastebin.com/873rBFYm



                protected function _initProduct()

                $sku = $this->getRequest()->getParam('sku');
                $productId = (int) $this->getRequest()->getParam('product');

                if($sku)
                $params = $this->getRequest()->getParams();
                $productId = Mage::helper('checkout/cart')->getProductIdByParams($params, false);
                if(! $productId)
                return false;



                if ($productId)
                $product = Mage::getModel('catalog/product')
                ->setStoreId(Mage::app()->getStore()->getId())
                ->load($productId);
                if ($product->getId())
                return $product;


                return false;



                my config.xml : pastebin.com/Ks85etyQ



                <?xml version="1.0" ?><config>
                <frontend>
                <routers>
                <checkout>
                <args>
                <modules>
                <abc_checkout before="Mage_Checkout">ABC_Checkout</abc_checkout>
                </modules>
                </args>
                </checkout>
                </routers>
                </frontend><global><helpers>
                <checkout>
                <rewrite>
                <cart>ABC_Checkout_Helper_Cart</cart>
                </rewrite>
                </checkout>
                </helpers></global></config>


                my helper : appcodelocalABCCheckoutHelperCart.php : pastebin.com/RZGSKJdr



                <?php class ABC_Checkout_Helper_Cart extends Mage_Checkout_Helper_Cart
                public function getProductIdByParams($param, $outputFlag = true)
                $sku = trim($param['sku']);
                $_product = Mage::getModel('catalog/product')->setStoreId(Mage::app()->getStore()->getId())
                ->loadByAttribute('sku', $sku);

                if($_product)
                $productTypeId = $_product->getTypeId();
                $productId = $_product->getId();
                if($productTypeId == 'simple')
                $result = $outputFlag ? true : $productId;

                elseif($productTypeId == 'configurable')
                $color = trim($param['color']);
                $size = trim($param['size']);
                $config = trim($param['option']);

                $configurableProduct = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
                $simpleCollections = $configurableProduct->getUsedProductCollection()
                ->addAttributeToSelect('id');
                if(! empty($color))
                $attrColor = $_product->getResource()->getAttribute("sp_color");
                $colorId = $attrColor->usesSource() ? $attrColor->getSource()->getOptionId($color) : '';
                $simpleCollections->addAttributeToFilter('sp_color', $colorId);

                if(! empty($size))
                $attrSize = $_product->getResource()->getAttribute("sp_size");
                $sizeId = $attrSize->usesSource() ? $attrSize->getSource()->getOptionId($size) : '';
                $simpleCollections->addAttributeToFilter('sp_size', $sizeId);

                if(! empty($config))
                $attrConfig = $_product->getResource()->getAttribute("sp_config");
                $configId = $attrConfig->usesSource() ? $attrConfig->getSource()->getOptionId($config) : '';
                $simpleCollections->addAttributeToFilter('sp_config', $configId);

                $simpleCollections->addFilterByRequiredOptions();

                if($simpleCollections->count() == 1)
                $productId = $simpleCollections->getFirstItem()->getId();
                $result = $outputFlag ? true : $productId;

                else
                $result = false;



                return $result;

                return false;



                so sku can be adding via url querystring like this :



                SIMPLE PRODUCT



                Parameter:<br/>
                ~ sku<br/>
                ~ qty<br/>


                a. Add product with qty = 1



                domain/id/index.php/checkout/cart/add/sku/ABCD<br/>
                or<br/>
                domain/id/index.php/checkout/cart/add?sku=ABCD


                b. Add product with qty more than 1



                domain/id/index.php/checkout/cart/add/sku/ABCD/qty/3<br/>
                or<br/>
                domain/id/index.php/checkout/cart/add?sku=ABCD&qty=3<br/>

                CONFIGURABLE PRODUCT<br/>
                Parameter:<br/>
                ~ sku<br/>
                ~ color<br/>
                ~ size<br/>
                ~ option (ex: used by XYZ)<br/>
                ~ qty<br/>
                ~ __store (id or en)<br/>


                a. Add product with qty = 1



                domain/id/index.php/checkout/cart/add/sku/XYZ/color/merah tua/size/M/__store/id<br/>
                domain/id/index.php/checkout/cart/add/sku/XYZ/color/maroon/size/M/__store/en<br/>
                domain/id/index.php/checkout/cart/add/sku/XYZ/option/bilqis/__store/id<br/>
                or<br/>
                domain/id/index.php/checkout/cart/add?sku=XYZ&color=merah tua&size=M&__store=id<br/>
                domain/id/index.php/checkout/cart/add?sku=XYZ&color=maroon&size=M&__store=en<br/>
                domain/id/index.php/checkout/cart/add?sku=XYZ&option=bilqis&__store=id<br/>


                b. Add product with qty more than 1



                domain/id/index.php/checkout/cart/add/sku/XYZ/color/merah tua/size/M/qty/3/__store/id<br/>
                domain/id/index.php/checkout/cart/add/sku/XYZ/color/maroon/size/M/qty/3/__store/en<br/>
                domain/id/index.php/checkout/cart/add/sku/XYZ/option/bilqis/qty/3/__store/id<br/>
                or<br/>
                domain/id/index.php/checkout/cart/add?sku=XYZ&color=merah tua&size=M&qty=3&__store=id<br/>
                domain/id/index.php/checkout/cart/add?sku=XYZ&color=maroon&size=M&qty=3&__store=en<br/>
                domain/id/index.php/checkout/cart/add?sku=XYZ&option=bilqis&qty=3&__store=id






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 21 mins ago









                Teja Bhagavan Kollepara

                3,00641949




                3,00641949










                answered Nov 27 '14 at 7:39









                Andhi IrawanAndhi Irawan

                3771720




                3771720



























                    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%2f45132%2fadding-a-product-to-the-cart-via-querystring-using-sku%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

                    Nidaros erkebispedøme

                    Birsay

                    Was Woodrow Wilson really a Liberal?Was World War I a war of liberals against authoritarians?Founding Fathers...