0

みんな

割引商品にラベルを追加する必要があります。製品に割引価格を追加すると(管理者 - 製品 - 割引 - 追加)、OK - 価格はその値になります。しかし、ラベルを追加できません。$discount 配列が空です。

だから私のproduct.tpl:

                            <span><?php echo $price; ?></span><?php } ?></b>    

                            <?php print_r($discounts);?>

そして私の conteroller/product.php $discounts = $this->model_catalog_product->getProductDiscounts($product_id);

        $this->data['discounts'] = array(); 

        foreach ($discounts as $discount) {
            $this->data['discounts'][] = array(
                'quantity' => $discount['quantity'],
                'price'    => $this->currency->format($this->tax->calculate($discount['price'], $product_info['tax_class_id'], $this->config->get('config_tax')))
            );
        }

        $this->data['options'] = array();

        foreach ($this->model_catalog_product->getProductOptions($product_id) as $option) { 
            if ($option['type'] == 'select' || $option['type'] == 'radio' || $option['type'] == 'checkbox' || $option['type'] == 'image') { 
                $option_value_data = array();

                foreach ($option['option_value'] as $option_value) {
                    if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) {
                        if ((($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) && (float)$option_value['price']) {
                            $price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
                        } else {
                            $price = false;
                        }

                        $option_value_data[] = array(
                            'product_option_value_id' => $option_value['product_option_value_id'],
                            'option_value_id'         => $option_value['option_value_id'],
                            'name'                    => $option_value['name'],
                            'image'                   => $this->model_tool_image->resize($option_value['image'], 50, 50),
                            'price'                   => $price,
                            'price_prefix'            => $option_value['price_prefix']
                        );
                    }
                }

                $this->data['options'][] = array(
                    'product_option_id' => $option['product_option_id'],
                    'option_id'         => $option['option_id'],
                    'name'              => $option['name'],
                    'type'              => $option['type'],
                    'option_value'      => $option_value_data,
                    'required'          => $option['required']
                );                  
            } elseif ($option['type'] == 'text' || $option['type'] == 'textarea' || $option['type'] == 'file' || $option['type'] == 'date' || $option['type'] == 'datetime' || $option['type'] == 'time') {
                $this->data['options'][] = array(
                    'product_option_id' => $option['product_option_id'],
                    'option_id'         => $option['option_id'],
                    'name'              => $option['name'],
                    'type'              => $option['type'],
                    'option_value'      => $option['option_value'],
                    'required'          => $option['required']
                );                      
            }
        }

        if ($product_info['minimum']) {
            $this->data['minimum'] = $product_info['minimum'];
        } else {
            $this->data['minimum'] = 1;
        }

        $this->data['review_status'] = $this->config->get('config_review_status');
        $this->data['reviews'] = sprintf($this->language->get('text_reviews'), (int)$product_info['reviews']);
        $this->data['rating'] = (int)$product_info['rating'];
        $this->data['description'] = html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8');
        $this->data['attribute_groups'] = $this->model_catalog_product->getProductAttributes($product_id);

        $this->data['products'] = array();

        $results = $this->model_catalog_product->getProductRelated($product_id);

        foreach ($results as $result) {
            if ($result['image']) {
                $image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_related_width'), $this->config->get('config_image_related_height'));
            } else {
                $image = false;
            }

            if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
                $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
            } else {
                $price = false;
            }

            if ((float)$result['special']) {
                $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
            } else {
                $special = false;
            }

            if ($this->config->get('config_review_status')) {
                $rating = (int)$result['rating'];
            } else {
                $rating = false;
            }

            $this->data['products'][] = array(
                'product_id' => $result['product_id'],
                'thumb'      => $image,
                'name'       => $result['name'],
                'price'      => $price,
                'special'    => $special,
                'rating'     => $rating,
                'reviews'    => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
                'href'       => $this->url->link('product/product', 'product_id=' . $result['product_id'])
            );
        }   

多分私は別のものを見る必要があります、いくつかの体が助けてくれますか?

4

0 に答える 0