0

Greetings StackExchange.

I' have a task where I cannot google anything on the subject.

I want to create a copy of the standard Magento product view but it should be accessible on a custom URL.

I have created a small module that loads up a empty template page on the URL myshop.test/productoftheday.

Is there a way i can use the following to my benefit?

  1. I have succeeded to reuse the layout and template files of catalog_product_view.
  2. In my php-error.log the following is showing:

Uncaught Error: Call to a member function getId() in /app/code/core/Mage/Review/Block/Product/View/List.php:40"

  1. Is there anything in the controller app/core/mage/catalog/controllers/productcontroller I can use to load the view correct regarding list item 2?
  • You meant to say you want load specific product on custom page? – Ravi Soni Jul 1 '19 at 17:44
  • @RaviSoni Yes exactly. With the same functionality as the product view with minor layout changes :) – Andreas Therkildsen Jul 1 '19 at 18:12
0

In your Block file, you can create below function

public function getProdcut() {
    $productId = 11; //your specific prodcut ID
    $product = Mage::getModel('catalog/product')->load($productId);
    return $product;
}

Now in your new layout PHTML file, you should get your product like below

<?php $product = $this->getProdcut() ?>

Here it's your specific product.

$product

| 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.