Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Как вывести первую цену опции на главную OpenCart?

Recommended Posts

Основная цена товара у меня - это опции, а основная цена ОС стоит равна 0. Как правильно вывести из опции стоимость товара?

Вот это отвечает за цену на главной странице:

        <?php if ($product['price']) { ?>
        <div class="price">
          <?php if (!$product['special']) {  ?>
            <span class="price-new"><?php echo $product['price']; ?></span>
            <?php if( preg_match( '#(\d+).?(\d+)#',  $product['price'], $p ) ) { ?> 
            <?php } ?>
          <?php } else { ?>
            <span class="price-new"><?php echo $product['special']; ?></span><br>
            <span class="price-old"><?php echo $product['price']; ?></span> 
            <?php if( preg_match( '#(\d+).?(\d+)#',  $product['special'], $p ) ) { ?> 
            <?php } ?>

А это как у меня внутри товара:

            <?php if ($options) { ?>
                <h3 class="product"><?php echo $text_option; ?></h3>
                <?php foreach ($options as $option) { ?>
                    <?php if ($option['type'] == 'select') { ?>
                        <div class="form-group<?php echo ($option['required'] ? ' required' : ''); ?>">
                            <label class="control-label" for="input-option<?php echo $option['product_option_id']; ?>"><?php echo $option['name']; ?></label>
                            <select name="option[<?php echo $option['product_option_id']; ?>]" id="input-option<?php echo $option['product_option_id']; ?>" class="form-control">
                                <?php foreach ($option['product_option_value'] as $option_value) { ?>
                                    <option value="<?php echo $option_value['product_option_value_id']; ?>"  points="<?php echo (isset($option_value['points_value']) ? $option_value['points_value'] : 0); ?>" price_prefix="<?php echo $option_value['price_prefix']; ?>" price="<?php echo $option_value['price_value']; ?>"><?php echo $option_value['name']; ?>
                                        <?php if ($option_value['price']) { ?>
                                          if ($option_value['price_prefix'] == '*') {
                                            if ($option_value['price_value'] != 1.0)
                                              printf("(%+d%%)", round(($option_value['price_value'] * 100) - 100) );
                                          } else {
                                            echo "(".$option_value['price'].")";
                                        <?php } ?>
                                <?php } ?>
                            <option value=""><?php echo $text_select; ?></option>
                    <?php } ?>
Как правильно вывести главную цену опции на главной? Делаю с помощью: 
<?php echo $option_value['price']; ?>


Получается просто пустота, без цены...)
Edited by retrojdev
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.