drcj64241 2016-03-23 12:29
浏览 37
已采纳

如何从Prestashop的数据库中获取特定产品

Is there any simple way to retrieve only 'Product Packs' from database? I want to display all the product pack combinations in different category.

And it would be great if I can disable this pack to be appeared in other category. If its become too much complex, I have no problem with it.

As I am using a custom templates I am giving a sample of code about how it displays product in my Prestashop 1.6.1.4.

<div class ='cate_title'>
                    {foreach from=$productCates item=productCate name=posTabCategory}
                     <div id="tabtitle_{$productCate.id}" class="tab_title">        
                            <h2>
                                <span>{$productCate.name}</span>
                            </h2>
                    </div>  
                    {/foreach}
                </div>
                <ul class="tab_cates"> 
                {$count=0}
                {foreach from=$productCates item=productCate name=posTabCategory}
                        <li data-title="tabtitle_{$productCate.id}" rel="tab_{$productCate.id}" {if $count==0} class="active"  {/if} > {$productCate.name}</li>
                        {$count= $count+1}
                {/foreach}  
                </ul>
            </div>  
            <div class="tab1_container"> 
            {foreach from=$productCates item=productCate name=posTabCategory}
                <div id="tab_{$productCate.id}" class="tab_category">
                    <div class="row">
                        <div class="productTabCategorySlider1">
                            {foreach from=$productCate.product item=product name=posTabCategory}

                                <div class="cate_item">
                                    <div class="item-inner">
                                        <a class ="bigpic_{$product.id_product}_tabcategory product_image" href="{$product.link|escape:'html'}" title="{$product.name|escape:html:'UTF-8'}"><img class="img-responsive" src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html'}" alt="{$product.name|escape:html:'UTF-8'}" />

      ..............................
      ...............................
  • 写回答

1条回答 默认 最新

  • doulian4762 2016-03-28 04:27
    关注

    Follow is sql by which you can get all pack products from database $pack_products = Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'product WHERE cache_is_pack = 1');

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀