Page 1 of 1

Calling ean number to php code

Posted: Thu Nov 17, 2016 2:55 am
by SubatWest
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 the catalog/controller/product/product.php is

Code: Select all

if ($this->config->get('for_sale_label_enabled')) {
    $data['$ean'] = $this->model_module_for_sale_label->getEan($product_info);
               if ($data['$ean'] == 1){
                        $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');

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.

Re: Calling ean number to php code

Posted: Fri Nov 18, 2016 5:47 pm
by SubatWest
I have now resolved this by definition in the controller