3

By Default Magento create new row in Database in table sales_flat_quote_item_option once we click on ADD TO CART

We are giving an option of uploading custom image on Product image with help of custom module.

When we upload custom image on Product image [ link ] & click on Add to cart, we are saving custom image in Database in table sales_flat_quote_item_option & in column : value .

enter image description here

As like Add to cart button, we want same feature for one more custom button Save Design.

Save design button

<button id="submit-editorApply-{{rand}}" >Save Design</button>

i want to know which code is responsible for creating new row in Database after clicking Add to cart button.

Where i need to look in Module's Block or Controllers or Data or Helper or Model ?

I can just copy Add to cart code and just rename to "Save design", but once we click on "Save design", i don't want to add Product to cart , I just want to create new row in Database.

15
  • i will give 100 bounty points if it worked for me...... Mar 2, 2017 at 12:20
  • do you want programeticlly addtocart ?? or just want to click addtocart button when someone click your button ?? Mar 3, 2017 at 5:11
  • @MurtuzaZabuawala Thanks for reply, i dont want programtically, in LINK1 or in link2 we have Add to cart & save design button, right now if we just upload image and click on add to cart button, new row will create in DB & image will save in Server. i want same feature for save design button also. Mar 3, 2017 at 5:16
  • but for that you have to manually upload image ?? how I get image ?? Mar 3, 2017 at 5:18
  • @MurtuzaZabuawala yes after we upload image manually, than only i want to save image in server and create new column in Database..... Mar 3, 2017 at 5:19

2 Answers 2

2

You can try below trick for that

 jQuery(document).ready(function(){
    jQuery("button[title='SAVE DESIGN']").click(function(){
     openCustimage("UserImage");
     setTimeout(function(){
        jQuery('.button.btn-cart').get(0).click();              
     }, 2000);  

    });    
 });
2
  • sorry, it didt worked for me Mar 7, 2017 at 7:58
  • Thanks a lot buddy for your support , as other user spent more time in helping me in link , i awarded bounty for him, need your support like this as always..... Mar 13, 2017 at 14:05
2
+50

You can try do something like this:

  1. add new column in sales_flat_quote_item_option named eg allowed_in_cart as bool (true / false) with default false value.
  2. Rewrite cart action app\code\core\Mage\Checkout\controllers\CartController.php :: indexAction for don't display products with value allowed_in_cart as false.

    However better way is 'disable' cart when allowed_in_cart is false instead of only don't display products.

  3. To Save Design Button add action change allowed_in_cart value to true for specific cart.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.