Magento php核心.编辑产品列表目录


Magento php core. Editing Product List Catalog

我有一些快速问题要问magento专家。我想对magento的PHP核心进行更改。

我想添加产品列表的详细信息,详细信息将取决于每个产品,并且我想在目录列表上显示额外的详细信息;PHP。

所以我的问题是——哪里能做到这一点?我不熟悉magento文件的结构,我需要这个匆忙,我希望我有时间研究它的结构,但这可能需要比我的截止日期更多的时间。

请注意,我说的是管理产品列表,而不是客户运输

如果是详细信息页面,您可能可以在/template/catalog/product/view.html中完成所有这些逻辑。如果它是类别页面,它将是/template/cacatalog/product/list.phtml。无论哪种方式,它都是一样的。

$categories = $product->getCategoryIds();  //this is array of category ids the product exists in
$blueCategoryIds = array(1,2,3,4);  
$redCategoryIds = array(5,6,7,8);
if(in_array($blueCategoryIds,$categories)){
    $newClass = 'blue-background';
} elseif (in_array($redCategoryIds,$categories)) {
    $newClass = 'red-background';
} else {
    $newClass='';
}

在CSS文件中定义.blue背景和.red背景。

.red-background {background:red;}
.blue-background {background:blue;}

然后在你想将背景应用到的任何html元素中使用$newClass。这可能应该是自定义模块a方法的一部分,但这应该很快。