0

I want to create a quickview option with my crosssells. When I click on the quickview button, I want a .phtml file to appear (custom/quickview.phtml), and display with product information such as name, id, image etc..

This is the situation:

  • I have 3 crosssell products on the cart page
  • Inside the foreach loop that generates the products, I want a button that calls the quickview.phtml file
  • I want to pass php variables, such as product ID, product name etc.

How do I do this? I cant find out how to do it.

3 Answers 3

1

I assume that you want the quickview.phtml to appear in a lightbox without leaving the current page.

To do this, you will need to change the button action to an ajax call with a custom controller action to return the new dynamic HTML.

There are a number of existing extensions out there, and I highly recommend that you use one of them instead of creating your own solution. To do this right, it could easily take dozens of hours to implement (especially if you have any configurable or bundled products).

Take a look here:

https://www.magentocommerce.com/magento-connect/catalogsearch/result/?q=product+quick+view&pl=0

I have used both the Amasty and Belvg ones in the past for various projects.

1
  • Hmmm, I would have loved making it myself, learning from it in the process. But you might be right. Thanks:) Nov 11, 2016 at 7:50
1

you can just pass the product id in a controller action and all the rest of the things can be obtained by id

yoursite.com/index.php/quickview/index/view/id

1

You need to create controller, block and view(phtml) to achieve this. Use below code in .phtml

<a href="<?php echo $block->getUrl('<module_name>/quickview/view', ['id'=>$id])?>">
        <button class="button" title="<?php echo __('Confirm Order') ?>" type="button">
            <span><span><span><?php echo __('Confirm Order') ?></span></span></span>
        </button>
</a>

In controller

public function execute()
    {
        $id = $this->getRequest()->getParam('id');
         // Your further code 
   }
3

Your Answer

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

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