Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8844605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:31:46+00:00 2026-06-14T11:31:46+00:00

I am trying to get this to work for some time now. My products

  • 0

I am trying to get this to work for some time now.

My products are contact lenses and when you want to order you need to fill some Options like Radius, Thickness, Diopter etc. twice (left eye and right eye).

I want when I press Add to cart, to add the same product twice in the cart (the first with the Options for the left eye and the second with the Options for the right eye).

Is this possible in Opencart?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:31:48+00:00Added an answer on June 14, 2026 at 11:31 am

    Basically, you want (for certain products) to show all the product info and options twice on screen, and have both sets added to cart when you click Add To Cart, so they appear as separate products.

    Repeating the options under certain conditions is fairly trivial.

    Sadly however, OpenCart’s Add To Cart expects just one set of product data. It expects this in four places:

    • the jQuery script that submits your options via Ajax
    • the routine that actually adds the product from the Ajax submission
    • the routine that adds the product from a standard form submission
    • the routine that says “Success! You added Bongo Contact Lens to your cart!”

    Even then, within the code that adds the product there is the assumption of one set of product options.

    There’s quite a lot of code that could need changing – and stuff that you don’t generally want to be messing with.

    But there is a way.

    Let us assume you don’t want to mess with index.php?route=checkout/cart/add and want to keep your code within the product.tpl template and JavaScript.

    What you will first need to do is wrap the product inputs (including hidden inputs) in a div with a unique class, say .lens-left, and use that class name in place of every instance of .product-info in the line:

    data: $('.product-info input[type=\'text\'], .product-info input[type=\'hidden\'], .product-info input[type=\'radio\']:checked, .product-info input[type=\'checkbox\']:checked, .product-info select, .product-info textarea'),
    

    Next, write some JS that is fired on relevant product pages on load and:

    1. Adds a new div with class lens-right and copies the contents of lens-left into it.
    2. Binds to the cart button a second Ajax call that is an exact copy of the standard one but uses the class name of the second set.

    With all this in place, clicking Add To Cart will add the first product to cart, then add the second product to cart. Doing this in sequence rather than together means that you’re only passing one set of data through at a time. Using JS to add the second set means that users without JS don’t see it.

    This could be improved further by making the on-load JS instead add a button that says “My left and right eyes need different lenses”, which would then fire all the other stuff.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay I have been trying to get this to work for some time now.
I've been trying to make this work for some time now, but I think
I've been struggling with this for some time now. I'm just trying to get
Im trying to get some auto complete to work. I have this URL i
I've spent too much time trying to get this to work on IE 7.
I've been trying to get the tab order to work on this datagrid for
I am trying to get the realtime stockquotes from google for some time now.
I have been trying to work with NIO SocketChannels for some time now, and
Trying to get this to work, with no luck: [DataMember] public Type ParameterType {
I am trying to get this to work but can't see where I'm going

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.