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.

  • i will give 100 bounty points if it worked for me...... – Baby in Magento Mar 2 '17 at 12:20
  • do you want programeticlly addtocart ?? or just want to click addtocart button when someone click your button ?? – Murtuza Zabuawala Mar 3 '17 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. – Baby in Magento Mar 3 '17 at 5:16
  • but for that you have to manually upload image ?? how I get image ?? – Murtuza Zabuawala Mar 3 '17 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..... – Baby in Magento Mar 3 '17 at 5:19
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);  

    });    
 });
  • sorry, it didt worked for me – Baby in Magento Mar 7 '17 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..... – Baby in Magento Mar 13 '17 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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