I’m working on a project where products are added directly from category listing page. No need to go to product page. When i click on “addtocart” button, it goes to the product page and shows message “options required”.

When i check view.phtml file, then i came to know that <?php echo $this->getChildHtml('product_type_data') ?> is responsible for it. Hence, i want to know

how i can load <?php echo $this->getChildHtml('product_type_data') ?> on category product listing (list.phtml page).


When you click add to cart it goes to **public function addAction() of location app\code\core\Mage\Checkout\controllers\CartController.php** near line no 191 in this function their is a code like $params = $this->getRequest()->getParams(); which consist all parameters passed from the page.

Things to Note

When you click on add to cart from listing page it might not getting all required parameter that's why it redirects you to detail page.

1) add product from detail page and add code in public function addAction(){ near line no 198 like

echo '<pre>';

And note all the parameter.

2) add same product from list and note the parameter you will definitely get a difference.

3) if you got a difference in above steps then passed the missing parameters from the listing page.

Hope this will help you. let me know if you required some more details.

| improve this answer | |

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.