3

I need add in cart for my products also and custom options, I need display not only total price but also custom options value with price.

Thanks

5
  • Sergey,Are you want to Programmatically cart custom option product
    – Amit Bera
    Commented Jul 30, 2014 at 5:21
  • stackoverflow.com/questions/23838558/…
    – Amit Bera
    Commented Jul 30, 2014 at 5:25
  • I need how this: prntscr.com/47up0l , test_1 and test_2 this custom options, i need price display also with custom options in cart, can?
    – Sergey
    Commented Jul 30, 2014 at 16:21
  • sergy.. you want to custom option price ?? it not clear in picture... please explain
    – Amit Bera
    Commented Jul 30, 2014 at 23:15
  • Yes i want custom options price display in cart, so where indicated by the arrow in the screenshot, there must be a price
    – Sergey
    Commented Jul 31, 2014 at 7:23

1 Answer 1

4

In default.phtml file at app/design/frontend/yourpackage/yourtemplate/template/checkout/cart/item add the below code

 <?php if ($_options = $this->getOptionList()):?>

    <?php $product=Mage::getModel('catalog/product')->load($_item->getProduct()->getId()); ?>

    <?php foreach ($_options as $_option) : ?>
    <?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
    <?php foreach ($product->getProductOptionsCollection() as $option) { ?>

    <?php if($option->getTitle()==$_option['label']):?>             
    <strong><?php //echo $this->htmlEscape($_option['label']) ?></strong>
    <?php //echo $_formatedOptionValue['value'] ?>
    <br/>
        <!-- -->
            <?php
              switch ($option->getGroupByType()) {
                          case Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT:

                foreach ($option->getValuesCollection() as $value) {
                    if($value->getTitle()==$_formatedOptionValue['value']){
                    echo "<br/>";
                   /*   echo '|value_id =>'. $value->getId();
                       echo '|title=>'.$value->getTitle();
                       echo '|price=>'. $value->getPrice();
                        echo '|price_type=>'. $value->getPriceType();
                       echo '|sku=>'. $value->getSku();
                       echo '|sort_order =>'. $value->getSortOrder();
                       */
                       if($value->getPriceType()=='fixed' && !is_null($value->getPrice())):
                       echo $value->getPrice()*$this->getQty();
                       endif;

                       if($value->getPriceType()=='percent' && !is_null($value->getPrice())):
                       echo $value->getPrice()*$this->getQty()*$Yourutemprice;
                       endif;



                    }
                }
                break;
                default:

                       if($option->getPriceType()=='fixed' && !is_null($option->getPrice())):
                       echo $option->getPrice()*$this->getQty();
                       endif;

                       if($option->getPriceType()=='percent' && !is_null($option->getPrice())):
                       echo $option->getPrice()*$this->getQty()*$Yourutemprice;
                       endif;



              }
              ?>      
            <!-- -->
        <?php endif; ?>        
     <?php } ?> 


    <?php endforeach; ?>
<?php endif;?>

enter image description here

5
  • Thanks Amit, but i have question: possible display price custom options in Unit price and Subtotal column? If custom options my checkout will have several options (my checkout 1 and my checkout 2), how will be work? And Yourutemprice what this? Thanks
    – Sergey
    Commented Aug 2, 2014 at 7:32
  • yes.you can display on unit price columns.Also my code have checked multiple Options.
    – Amit Bera
    Commented Aug 2, 2014 at 7:55
  • If you have time can you explain?
    – Sergey
    Commented Aug 2, 2014 at 8:11
  • i am busy..let you khow
    – Amit Bera
    Commented Aug 2, 2014 at 8:12
  • Amit you have time help me?
    – Sergey
    Commented Aug 4, 2014 at 22:58

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.