Post by SubatWest » Thu Nov 17, 2016 2:55 am

Hi
I have taken a module and re-wrote it to place a particular label on category and product images. It worked by using quantity = a particular number. It worked exactly as I wanted and did a grand job.
I then wanted to place a different lable using the EAN but I cannot get it to function. The code I am using in OC 2.1.0.1 the catalog/controller/product/product.php is

Code: Select all

if ($this->config->get('for_sale_label_enabled')) {
                    $this->load->model('module/for_sale_label');
    $data['$ean'] = $this->model_module_for_sale_label->getEan($product_info);
               if ($data['$ean'] == 1){
                        $this->load->model('module/for_sale_label');
                        $data['text_for_sale'] = $this->model_module_for_sale_label->getLabel((int) $this->config->get('config_language_id'));
                        $data['for_sale_label_style'] = htmlspecialchars_decode($this->config->get('for_sale_label_style'));
                        $data['for_sale_label_show_marker_in_product_page'] = $this->config->get('for_sale_label_show_marker_in_product_page');
                    }
                }
and

Code: Select all

  '$ean' =>($this->config->get('for_sale_label_enabled'))?$this->model_module_for_sale_label->getEan($result):1,
and in catalog/view/theme/*/template/product/product.tpl

Code: Select all

 <?php if (isset($for_sale_label_style) && isset($for_sale_label_show_marker_in_product_page) && $for_sale_label_show_marker_in_product_page) { echo "<style>$for_sale_label_style</style>";} ?>
              <?php if (isset($ean) && $ean == 1 && isset($text_for_sale)&& isset($for_sale_label_show_marker_in_product_page) && $for_sale_label_show_marker_in_product_page){ ?>
                <div class="is-mark"><?php echo $text_for_sale; ?></div>
                <?php } ?>
I know the code works with quantity so the issue is with the ean and getting it to equal the number.
Can anyone help to point me in the right direction>
As always, grateful for the guys on the forum who are willing to help.

New member

Posts

Joined
Fri Oct 31, 2014 1:29 am

Post by SubatWest » Fri Nov 18, 2016 5:47 pm

I have now resolved this by definition in the controller

New member

Posts

Joined
Fri Oct 31, 2014 1:29 am
Who is online

Users browsing this forum: No registered users and 52 guests