微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

图片的url没有出现在Opencart中,model_catalog_product-> getProductImages

如何解决图片的url没有出现在Opencart中,model_catalog_product-> getProductImages

显示所有产品的目录页面上,我在catalog.PHP添加了以下代码显示产品的所有图像。然后我在目录页面上创建了一个 for 循环。 for 循环工作并在视觉上重复自身。但是不显示图片的url。

添加代码

目录.PHP;

$images2 = array();
                $results2 = $this->model_catalog_product->getProductimages($result['product_id']);
                foreach ($results2 as $resultt) {
                    $images2[] = array(
                        'popup' => $this->model_tool_image->resize($resultt['image'],$this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_width'),$this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_height')),'thumb' => $this->model_journal3_image->resize($resultt['image'],$this->journal3->themeConfig('image_product_width'),$this->journal3->themeConfig('image_product_height'),$this->journal3->themeConfig('image_product_resize'))
                    );
                }
        
        $data['products'][] = array(

            'classes'        => array(
                defined('JOURNAL3_ACTIVE') ? $this->journal3->productExcludeButton($result,$price,$special) : null,),'quantity'       => defined('JOURNAL3_ACTIVE') ? $result['quantity'] : null,'stock_status'   => defined('JOURNAL3_ACTIVE') ? $result['stock_status'] : null,'thumb2x'        => defined('JOURNAL3_ACTIVE') ? $image2x : null,'second_thumb'   => defined('JOURNAL3_ACTIVE') ? $second_image : null,'second_thumb2x' => defined('JOURNAL3_ACTIVE') ? $second_image2x : null,'labels'         => defined('JOURNAL3_ACTIVE') ? $this->journal3->productLabels($result,'extra_buttons'  => defined('JOURNAL3_ACTIVE') ? $this->journal3->productExtraButton($result,'date_end'       => defined('JOURNAL3_ACTIVE') ? $this->journal3->productCountdown($result) : null,'price_value'    => defined('JOURNAL3_ACTIVE') ? ($result['special'] ? $result['special'] > 0 : $result['price'] > 0) : null,'stat1'          => defined('JOURNAL3_ACTIVE') ? $this->journal3->productStat($result,$this->journal3->settings->get('globalProductStat1')) : null,'stat2'          => defined('JOURNAL3_ACTIVE') ? $this->journal3->productStat($result,$this->journal3->settings->get('globalProductStat2')) : null,'product_id'  => $result['product_id'],'thumb'       => $image,'name'        => $result['name'],'description' => utf8_substr(trim(strip_tags(html_entity_decode($result['description'],ENT_QUOTES,'UTF-8'))),(int)$this->journal3->themeConfig('product_description_length')) . '..','price'       => $price,'special'     => $special,'tax'         => $tax,'minimum'     => $result['minimum'] > 0 ? $result['minimum'] : 1,'rating'      => $result['rating'],'href'        => $this->url->link('product/product','&product_id=' . $result['product_id'] . $url),'images'      => $images2
        );
    }

product_card.twig ;

                  {% for image in product.images %}

                <div class="carousel-item active">
                  <img class="d-block" src="{{ images.thumb }}" alt="product-img">
                </div>

            {% endfor %}

结果如下:

<div class="carousel-item active">
      <img class="d-block" src="" alt="product-img">
 </div>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。