我希望能够装上客户的希望清单,并将产品贴出清单。
我正在使用:
$wishList = Mage::getSingleton( wishlist/wishlist )->loadByCustomer($customer);
$wishListItemCollection = $wishList->getItemCollection();
问题是,项目收集的阵列受到保护,我找不到任何方法提取数据。
是否有其他办法这样做?
我希望能够装上客户的希望清单,并将产品贴出清单。
我正在使用:
$wishList = Mage::getSingleton( wishlist/wishlist )->loadByCustomer($customer);
$wishListItemCollection = $wishList->getItemCollection();
问题是,项目收集的阵列受到保护,我找不到任何方法提取数据。
是否有其他办法这样做?
你非常接近你们的目标。
$wishList = Mage::getSingleton( wishlist/wishlist )->loadByCustomer($customer);
$wishListItemCollection = $wishList->getItemCollection();
if (count($wishListItemCollection)) {
$arrProductIds = array();
foreach ($wishListItemCollection as $item) {
/* @var $product Mage_Catalog_Model_Product */
$product = $item->getProduct();
$arrProductIds[] = $product->getId();
}
}
阵列变数<代码> Ids现在将载有该特定客户希望列入的所有产品识别资料清单。
你的法典是正确的。 可能没有装满客户。 这里是法典。
$customer = Mage::getSingleton( customer/session )->getCustomer();
$wishlist = Mage::getModel( wishlist/wishlist )->loadByCustomer($customer, true);
$wishListItemCollection = $wishlist->getItemCollection();
foreach ($wishListItemCollection as $item)
{
// do things
}
在任何模板中,使用Magento 1.8,这一工程
Total: <?php echo $this->helper( wishlist )->getItemCount() ?>
// Items
$this->helper( wishlist )->getWishlist()->getItemCollection();
$wishList = Mage::getSingleton( wishlist/wishlist )->loadByCustomer($customer);
$wishListItemCollection = $wishList->getItemCollection();
foreach ($wishListItemCollection as $item)
{
//do your thing e.g. echo $item->getName();
}
用所有细节,如姓名、图像等,进行这项工作。
<?php
$customer = Mage::getSingleton( customer/session )->getCustomer();
if($customer->getId())
{
$wishlist = Mage::getModel( wishlist/wishlist )->loadByCustomer($customer, true);
$wishListItemCollection = $wishlist->getItemCollection();
foreach ($wishListItemCollection as $item)
{
echo $item->getName()."</br>";
echo $item->getId()."</br>";
echo $item->getPrice()."</br>";
echo $item->getQty()."</br>";
$item = Mage::getModel( catalog/product )->setStoreId($item->getStoreId())->load($item->getProductId());
if ($item->getId()) :
?>
<img src="<?php echo Mage::helper( catalog/image )->init($item, small_image )->resize(113, 113); ?>" width="113" height="113" />
<?php endif; } } ?>
When using the Magento collection method addFieldToFilter is it possible to allow filtering by NULL values? I want to select all the products in a collection that have a custom attribute even if no ...
I am new to Magento and using their API. I need to be able to get the product url from the API call. I see that I can access the url_key and url_path, but unfortunately that s not necessarily what ...
My problem is I want to change my category page layout similar as homepage I tried a lot but didn t get the answer.
I want to install a Magento extension in WAMP, but not from the Magento connect system. How can I do this? I have the module (extension) code and I already installed the sample data in the Magento ...
Is it possible to redirect the browser to nth step in the onepage checkout? If so, how would one go about doing it? I m working on a payment module and have a sort of "cancel" action that i would ...
I was wondering if it possible to link a category to My Account . Basically I would like to make My Account more prominent, by creating a category - My Account which appears in the main menu ...
I have a ‘featured’ attribute, which has a Yes/No select-list as the admin input. I presume that the values for Yes and No are 1 and 0, as they are for every other Yes/No list. However, if I try and ...
I tried importing product images into Magento using an absolute path, but it did not work. The image was not uploaded. For example, I tried importing "http://somewebsite.com/someimage.jpg". The image ...