I'm would like to call a products custom attributes in my own .phtml file, but having some issues with it. Any help is greatly appreciated.

I have the following code in my template/catalog/product/view.phtml file:

<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('customstuff/deliveries_returns.phtml')->toHtml(); ?>

Which calls my own custom .phtml file in template/customstuff/deliveries_returns.phtml

In that .phtml file I have this code:

Delivery Times:</strong> <?php echo $_product->getshipping_times() ?></p>Delivery Costs: <?php echo $_product->getdelivery_costs() ?></p>

I have set up custom attributes already with the attribute codes shipping_times and delivery_costs

On the front-end of my website i get the following error message: Production time: Fatal error: Call to a member function getshipping_times() on a non-object in /home/cuffandc/public_html/app/design/frontend/mytheme/default/template/customstuff/deliveries_returns.phtml on line 11

Any help is greatly appreciated!

1 Answer 1


In deliveries_return.phtml not find object proper object of Product.

You can try

      echo $this->getLayout()->createBlock('catalog/product_view')->setTemplate('customstuff/deliveries_returns.phtml')->toHtml(); 

and Add this code in deliveries_returns.phtml

<?php $_product = $this->getProduct(); ?>
 Delivery Times:</strong> <?php echo $_product->getshipping_times() ?></p>Delivery Costs: <?php echo $_product->getdelivery_costs() ?></p>

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.