久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

按類別 ID 列出的 Magento 產(chǎn)品列表

Magento Product Listing by Category ID(按類別 ID 列出的 Magento 產(chǎn)品列表)
本文介紹了按類別 ID 列出的 Magento 產(chǎn)品列表的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我有一個 magento (1.5) 商店和一個 wordpress (3.2) 博客.

I have a magento (1.5) store and a wordpress (3.2) blog.

wordpress 博客充當主站點和主頁索引.

The wordpress blogs acts as the main site and the home-page index.

使用 Mage-Enabler,我將 wordpress 和 magento 集成在一起,我能夠提取結(jié)帳塊、快速鏈接和所有文件.

Using Mage-Enabler, I have integrated wordpress and magento together and I am able to pull the checkout block, quick links and all the files.

我的問題是我想在主頁上顯示最暢銷的類別.我通常會使用 CMS 中的 XML 來執(zhí)行此操作.例如

My question is that I would like to display the top-sellers categories on the home-page. I would usually do this with the XML in the CMS. e.g.

{{block type="catalog/product_list" category_id="your_category_id" template="catalog/product/list.phtml"}} 

但這在這種情況下是不可能的,因為商店主頁是不可見的,例如,當用戶點擊導(dǎo)航上的在線購物按鈕時,它會將他們帶到顯示所有類別和搜索的類別登陸頁面.

But this is not possible in this instance as the store home-page is not seen e.g when a user clicks on the shop-online button on the navigation it takes them onto the category lander page showing all the categories and a search.

我的邏輯讓我通過 PHP 來做到這一點,例如

My logic has lead me to do this via PHP e.g

<?php

$categoryId = 123; // a category id that you can get from admin
$category = Mage::getModel('catalog/category')->load($category_Id);

?>

...這將在產(chǎn)品的副本中 > list.phtml 頁面.

... this would be inside a copy of the product > list.phtml page.

是否可以通過 PHP 模板而不是管理中的塊類型 XML 通過特定類別將產(chǎn)品拉入列表中?

Is this possible to pull products in a list via a specfic category via PHP templates rather than the block types XML in the admin?

謝謝

卡梅隆

推薦答案

這應(yīng)該滿足您的需求:

<?php

$categoryid = 12;

$category = Mage::getModel('catalog/category');
$category->load($categoryid);
$collection = $category->getProductCollection();
$collection->addAttributeToSelect('*');

foreach ($collection as $_product) { ?>

<a href="<?php echo $_product->getProductUrl() ?>"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(200); ?>" width="200" height="200" alt="" /></a> <a href="<?php echo $_product->getProductUrl(); ?>"><?php echo $_product->getName(); ?></a>

<?php } ?>

這篇關(guān)于按類別 ID 列出的 Magento 產(chǎn)品列表的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 個表)
How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 設(shè)置?)
Auto populate a select box using an array in PHP(使用 PHP 中的數(shù)組自動填充選擇框)
PHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 從 MSSQL-SELECT 產(chǎn)生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名稱 ASC)
主站蜘蛛池模板: 欧美精品在线播放 | 欧美午夜精品 | 日韩aⅴ在线观看 | 精品欧美一区二区久久久伦 | 99色综合 | 91久久综合亚洲鲁鲁五月天 | 成人av一区 | 日本久久久影视 | 一区二区三区av | 成人一区二区在线 | 中文字幕在线一区二区三区 | 精品国产一区久久 | 久久精品国产v日韩v亚洲 | 在线成人免费视频 | 神马影院一区二区三区 | 在线观看亚洲专区 | 欧美日韩在线视频一区 | 日韩在线播放网址 | 日本午夜在线视频 | 国产成人亚洲精品 | 中文字幕日韩欧美 | 国产欧美三区 | 日日操网站 | 国产在线91| 欧美一区二区免费 | 久久精品国产久精国产 | 欧美一区二区小视频 | 一区二区三区在线电影 | 国产一区二区三区不卡av | 一区二区三区欧美 | 日韩欧美在线视频 | 狠狠操av | 在线成人www免费观看视频 | 精品国产18久久久久久二百 | 日韩有码一区二区三区 | 特级特黄特色的免费大片 | 亚洲高清在线免费观看 | 欧美爱爱视频 | av片毛片| 午夜精品久久久久久久久久久久 | 亚洲福利一区二区 |