0

I know that a few themes have this by default but my one doesn't, and i just cant get this to work.

I have a configurable Product which has three options with different prices. I want to show the price difference to the linked simple product in brackets. So it should basically look like this:

Price: XX€

(x) option 1 – ( ) option 2 (+ 4,00$) – ( ) option 3 (+ 12,00$)

How do i do this?

1 Answer 1

0

I think you want to display it on view.phtml but you could make this where you want.

$product -> configurable

 <?php echo 'Price: ' . $product->getPrice() . '<br>'; ?>

    <?php 
$childs = $product->getTypeInstance()->getUsedProducts(); 
foreach($childs as $child){
    echo $child->getName() . ' - ' ; 
} 
 ?>

this should display what you want, but check that you make a good display with the first and last child to get the correct output.

2
  • Thank's a lot for your effort! I want to display it in configurable.phtml but i get this error Parse error: syntax error, unexpected 'foreach' (T_FOREACH) in ...default/template/catalog/product/view/type/options/configurable.phtml on line 49 Commented Jan 21, 2016 at 11:03
  • It's becouse i miss a ';' before foreach. I don't know it it will work perfectly, but it's a way to make it like this.
    – ntzz
    Commented Jan 21, 2016 at 12:36

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.