Magento - direct link to add product to cart with control mechanism -


is there chance check if product in cart if used direct link add product cart? example, send customer link, he/she click on 1 time , mystake click again. result is, in cart 2 times more pieces.

we use 1 product option, text field, unique (in example - options[8]=ax587ad9) each order/customer, maybe there way check via api.

we can use mechanim check before magento frontend, , redirect cart or use link add product cart...

example of direct link: http://www.example.com/checkout/cart/add?product=161&qty=1&options[8]=ax587ad9

thanks every suggestion, igor

you can check if product in cart or not using event observer.

you can use checkout_cart_product_add_before event check if product in cart. config file this

<config> ... <frontend>     ...     <events>         <checkout_cart_product_add_after>             <observers>                 <unique_event_name>                     <class>{{modulename}}/observer</class>                     <method>checkitem</method>                 </unique_event_name>             </observers>         </checkout_cart_product_add_after>     </events>     ... </frontend> ... 

, in observer check logic if in cart or not

 class <namespace>_<modulename>_model_observer {          public function checkitem(varien_event_observer $obs)         {             // quote item             $item = $obs->getquoteitem();             //and put logic here             // condition matched redirect customer message          }        } 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -