多嚿魚教室

Opencart優化技巧

有些商品我沒有加入圖片。怎樣不顯示它們在Special、Featured和Latest這三個模版內?
沒有圖片的商品顯示出來實在格格不入!
Finding Solution
以下方法適用於Opencart v1.5.1.3
修改步驟:
  1. 開啟[catalog/view/theme/default/template/module]。
  2. 編輯三個檔案:[special.tpl]、[featured.tpl]、[special.tpl]。
  3. 搜尋以下程式碼:
    $this->data['products'][] = array(
  4. 在前一行加入以下程式碼:
    if ($image) 
這樣沒有圖片的商品就不會顯示在Special、Featured和Latest這三個模版內。
<p>
&#60;!--<br />
Make sure that you have properly installed Opencart vQmod.<br />
Copy this page of script.<br />
Save as a .xml file of utf-8 encoding without BOM into the directory [vqmod/xml].<br />
Name the file as you like.<br />
--&gt;</p>
<pre contenteditable="true">
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;modification&gt;
&nbsp;&lt;id&gt;Hide products without photos&lt;/id&gt;
&nbsp;&lt;version&gt;1.0.0&lt;/version&gt;
&nbsp;&lt;author&gt;Flexidigi Solution Ltd&lt;/author&gt;
&nbsp;&lt;file name=&quot;catalog/controller/module/latest.php&quot;&gt;
&nbsp;&nbsp;&lt;operation error=&quot;skip&quot;&gt;
&#32;&#160;&nbsp;&lt;search position=&quot;before&quot;&gt;&lt;![CDATA[
&#32;&#160;&nbsp;$this-&gt;data[&#39;products&#39;][] = array(
&#32;&#160;&nbsp;]]&gt;&lt;/search&gt;
&#32;&#160;&nbsp;&lt;add&gt;&lt;![CDATA[if ($image) ]]&gt;&lt;/add&gt;
&nbsp;&nbsp;&lt;/operation&gt;
&nbsp;&lt;/file&gt;
&nbsp;&lt;file name=&quot;catalog/controller/module/featured.php&quot;&gt;
&nbsp;&nbsp;&lt;operation error=&quot;skip&quot;&gt;
&#32;&#160;&nbsp;&lt;search position=&quot;before&quot;&gt;&lt;![CDATA[
&#32;&#160;&nbsp;$this-&gt;data[&#39;products&#39;][] = array(
&#32;&#160;&nbsp;]]&gt;&lt;/search&gt;
&#32;&#160;&nbsp;&lt;add&gt;&lt;![CDATA[if ($image) ]]&gt;&lt;/add&gt;
&nbsp;&nbsp;&lt;/operation&gt;
&nbsp;&lt;/file&gt;
&nbsp;&lt;file name=&quot;catalog/controller/module/special.php&quot;&gt;
&nbsp;&nbsp;&lt;operation error=&quot;skip&quot;&gt;
&#32;&#160;&nbsp;&lt;search position=&quot;before&quot;&gt;&lt;![CDATA[
&#32;&#160;&nbsp;$this-&gt;data[&#39;products&#39;][] = array(
&#32;&#160;&nbsp;]]&gt;&lt;/search&gt;
&#32;&#160;&nbsp;&lt;add&gt;&lt;![CDATA[if ($image) ]]&gt;&lt;/add&gt;
&nbsp;&nbsp;&lt;/operation&gt;
&nbsp;&lt;/file&gt;
&lt;/modification&gt;
</pre>

0 comments:

Post a Comment