小编thi*_*hod的帖子

如何在数组中存储产品数量

我有一个数据数组,将所有产品的购物车中的所有商品总计为一个数字.

我一直试图找到一种方法来获取数据数组count()购物车中所有不同项目的所有不同总数,并将它们以我的数据层逗号分隔.我希望这是有道理的.

if ($order->getId()) {
    $items = $order->getAllVisibleItems();
    $itemIds = array();
    $itemNames = array();
    $itemPrices = array();
    $itemMargins = array();
    $itemTypes = array();
    $itemGenders = array();
    $itemSports = array();
    $itemCategoryIds = array();
    $itemCategoryNames = array();
    /** @var Mage_Sales_Model_Quote_Item $item */
    foreach ($items as $item) {

        // Get the parent item - it is NOT included in the quote due to
        // customizations made by the OrganicInternet module for simple
        // product pricing. So I had to come up with another …
Run Code Online (Sandbox Code Playgroud)

php arrays count

17
推荐指数
1
解决办法
553
查看次数

在我的新商店视图中使用我的默认商店中的所有图像

我有一个新的商店视图,我使用magento管理员更新了所有产品:**Manage Products > Select all > Update Attributes**然后选择新商店.现在我的所有产品都与我的新商店视图有关,我的所有图片都有问题.在前端显示所有占位符.在管理面板中,当我点击产品然后图像..它可能有图像但它没有被选择使用基本图像,小图像或缩略图.

有没有办法更新我的新商店视图上的所有图像,以使用默认的商店视图主图像?

require_once 'abstract.php';

class Attach_Default_Store_Images Extends Mage_Shell_Abstract {

    public function run()
    {
        $products = Mage::getModel('catalog/product')->getCollection();
        foreach ($products as $product) {
            $productFrom = $product->setStoreId(1)->getImage();
            $productTo = $product->setStoreId(13)
            ->setImage($productFrom)
            ->setSmallImage($productFrom)
            ->setThumbnail($productFrom);
            echo "Images Updated\n";
            $product->save();
   }

        Mage::getModel('catalog/product_image')->clearCache();
        echo "Image Cache Cleared\n";

    }


    public function usageHelp()
    {
        return <<<USAGE
Usage:  php -f cache.php -- [options]
        php -f cache.php -- clean

  clean             Clean Old Cache
  help              This help

USAGE;
    }
}

$shell = new …
Run Code Online (Sandbox Code Playgroud)

php shell image magento

8
推荐指数
1
解决办法
197
查看次数

wordpress fishpig magento安装 - getPostListHtml()

我使用第三方模块fishpig在我的magento商店安装了wordpress.

我有一个名为list.phtml的页面,它使用$this->getPostListHtml()我添加了另一个div并复制它来发布类别中的所有内容,但现在它只是将第一个div中的帖子复制到第二个div中.如何创建一个独特的第二个div,所以当在后端发布帖子时,它只会发布到同一页面上的第二个div.目前我通过slug和post collection获得分类,然后设置顺序(asc)然后我循环通过类别和骑手为每个页面拉动相似的内容.我有几个页面,但在每个车手页面上,它仍然必须在Team下面有Team 2的帖子.我希望这是有道理的.

CPT /团队/ list.phtml

<?php
/**
 * Team (Rider) - Landing Page
 */
/* @var $this test_Wordpress_Block_Cpt_Type_View */

/* @var $helper test_Wordpress_Helper_Data */
$helper = $this->helper('wordpress');
/* @var $postType Fishpig_Wordpress_Addon_CPT_Model_Type */
$postType = $this->getPostType();
$categorySlug = $this->getCurrentCategorySlug();
$allCategories = $helper->getAllCategories();

$instagramHandles = array(
    'skate' => 'testskate',
    'surf' => 'testsurf',
    'snow' => 'testsnow',
    'mx' => 'testmx',
    'testunity' => 'testunity',
    'girls' => 'testgirls',
);

$textRider = ($categorySlug == 'testunity') ? 'Ambassador' : 'Rider';
$htmlRiderPicks = $this->getChildHtml('picks');
$hasEvents …
Run Code Online (Sandbox Code Playgroud)

php wordpress foreach magento slug

8
推荐指数
1
解决办法
371
查看次数

标签 统计

php ×3

magento ×2

arrays ×1

count ×1

foreach ×1

image ×1

shell ×1

slug ×1

wordpress ×1