0

同じメーカーの他の製品のリストである製品詳細ページに表示するimトレイ。つまり、あなたがアディダスの靴を履いている場合、ページには別のアディダス製品が表示されます。だから私はこのコードを持っています:

http://codepad.org/pO8XF0OI(ここでコードを書く方法がわからない)

実際に動作していますが、メーカー別のカテゴリ別の製品のみが表示されます。

私が間違っているのは何ですか?

4

2 に答える 2

0

コードは次のとおりです。

<?php
    $db = &JFactory::getDBO();
    $manufacturer = $this->product->virtuemart_manufacturer_id;
    $sql = "SELECT N.product_name,I.virtuemart_media_id,M.virtuemart_product_id,MN.mf_name 
    FROM h3ls8_virtuemart_product_manufacturers AS M 
    LEFT JOIN h3ls8_virtuemart_products AS P ON M.virtuemart_product_id = P.virtuemart_product_id
    LEFT JOIN h3ls8_virtuemart_products_es_es  AS N ON N.virtuemart_product_id = M.virtuemart_product_id
    LEFT JOIN h3ls8_virtuemart_product_medias  AS I ON M.virtuemart_product_id = I.virtuemart_product_id
    LEFT JOIN h3ls8_virtuemart_manufacturers_es_es AS MN ON MN.virtuemart_manufacturer_id = M.virtuemart_manufacturer_id
    WHERE M.virtuemart_manufacturer_id = '$manufacturer'"; // h3ls8_ is your table Prefix
    $db->setQuery($sql);
    $db->query();
    /* $res = $db->loadAssocList(); //This Load the info as a List */
    $prod = $db->loadObjectList(); // This Load the info as a group of objects for loading it.

    JRequest::setVar('virtuemart_manufacturer_id',$this->product->virtuemart_manufacturer_id,'GET');
    $productModel = VmModel::getModel('product');

    if ($this->product->virtuemart_manufacturer_id !=0 ) {
        $products = $prod;
        $productModel->addImages($products);
        $this->assignRef('products', $products);
    }
    // Show Products
    if (!empty($products)) { ?>
        <div class="seven columns obras">
            <h5> Obras </h5>
            <div class="row">
                <?php
                // Start the Output
                foreach ($products as $product) {
                // Show Products
                ?>
                <div class="four columns mobile-two end producto">
                    <div class="imagen">
                        <!-- <?php //if ($product->product_special == 1) { ?>
                        <div class="oferta">
                            <br />
                        </div>
                        <?php}?> *** If you wanna add some especial icon to a Special product uncommnent this *** -->  
                        <?php 
                            echo JHTML::_('link', JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id='.$product->virtuemart_product_id.'&virtuemart_category_id='.$product->virtuemart_category_id),$product->images[0]->displayMediaThumb('class="catImage"',false));
                        ?>
                    </div>
                </div> <!-- end of product -->
                <?php } ?>
            </div>
        </div>
    <?php } ?>
于 2013-03-15T15:18:13.833 に答える
0

これを試して、

Vm2.x を使用している場合、1 つの製造元で完全な製品が提供されます。要件に基づいて別のテーブルを追加または削除できます。

                            $db = &JFactory::getDBO();
                            $sql = "SELECT N.product_name,M.virtuemart_product_id,MN.mf_name 
                            FROM jos_virtuemart_product_manufacturers AS M 
                            LEFT JOIN jos_virtuemart_products AS P ON M.virtuemart_product_id = P.virtuemart_product_id
                            LEFT JOIN jos_virtuemart_products_en_gb  AS N ON N.virtuemart_product_id = M.virtuemart_product_id
                            LEFT JOIN jos_virtuemart_manufacturers_en_gb AS MN ON MN.virtuemart_manufacturer_id = M.virtuemart_manufacturer_id
                            WHERE M.virtuemart_manufacturer_id = '$manufature_id'";
                            $db->setQuery($sql);
                            $db->query();
                            $res = $db->loadAssocList();
                            echo "<pre/>";
                            print_r($res);

これが役立つことを願っています...

于 2013-03-14T03:09:26.347 に答える