0

I'm needing to add a Quick View/Quick Buy feature to my client's products page. Basically when they click the Quick Buy button a modal/div containing product details and a Buy button should display. My client would rather have this than a separate product details page. Is there a recommended way to do this? I was thinking that I could pass the product id as a parameter in the call to open up the modal and have the product details functionality hidden in the modal div.

I've added the code below.

    <!-- product with call to modal -->
    {exp:channel:entries channel="assets" dynamic="no" sort="asc" category="22" limit="1" entry_id="23"}
 <ul>
      <li><strong>Date:</strong> {asset_date}</li>
      <li><strong>Price:</strong> {product_price}</li>
      <li><strong>Status: <span style="color: #5cb85c">Available</span></strong></li>
      <li class="reserve-button"><a data-toggle="modal" href="#styledModal" data-id="{entry_id}" class="btn btn-primary btn-sm">Reserve Asset</a></li>
  </ul>
  {/exp:channel:entries}

    <!-- product details modal content -->
    {exp:channel:entries channel="assets" category_id="22" limit="1"}
      {exp:cartthrob:add_to_cart_form id="add-cart" entry_id="{entry_id}" no_tax="{no_tax}" no_shipping = "{no_shipping}" return="checkout/view_cart"} 
        <ul>
          <li><strong>Date:</strong> {asset_date}</li>
          <li><strong>Price:</strong> {product_price}</li>
          <li><strong>Status: <span style="color: #5cb85c">Available</span></strong></li>
          <li class="reserve-button"><button type="submit" class="btn btn-primary btn-sm">Reserve Asset</button></li>
        </ul>
      {/exp:cartthrob:add_to_cart_form} 
     {/exp:channel:entries}
0

I may be misunderstanding, but whether your div is modal or not isn't a any kind of deal really - you'd just have (another) add_to_cart form in it along with any details you need.

5
  • Thank you, Jeremy. Thank you for your reply. That's kind of what I was thinking but i'm having issues passing the entry_id for some reason. Works fine if I use entry_id_path and want to go to a details page. But the modal is not picking up the id. I've updated the initial entry with the code I've written to get this going. I left out the modal divs in the snippet above just to make it cleaner. If you have time to look it over, that would be great. I appreciate your time.
    – hurjas
    Feb 16 '14 at 8:32
  • Hurjas - I think your basic issue is more structural - why do you need two channel entries loops (with different paramaters!) - I would wrap the whole thing in one channel entries loop. I am going to guess your issue is your second channel entries look does not have dynamic="no" or an entry_id etc... (Of course even better might be to use stash to set all the data for alter retrieval but that's beyond the scope of this question!). Feb 16 '14 at 23:06
  • Jeremy, thank you. You were spot on. I was overthinking it a bit. Cleaned up the multiple channel entries and wrapped everything in one channel entries loop and the 'quick buy' is working as intended. I was looking at Stash before you made the recommendation. I will work on that next. Again, thank you.
    – hurjas
    Feb 18 '14 at 6:59
  • No worries. With EE its often the way - stepping back and looking at the bigger picture can really help. Stash is a huge leap forward for EE dev once you work it out. Good luck! Feb 18 '14 at 11:01
  • @hurjas how did you set this up? Could you provide me with the code?
    – Gfive
    Feb 25 '15 at 13:27

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.