Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. $mod = Mage::getModel('wishlist/wishlist')->getCollection();
  2. $data_wishlist = array();
  3. foreach($mod as $data)
  4. {
  5. $item_array = array();
  6. $load = Mage::getModel('wishlist/wishlist')->load($data->getId())->getItemCollection();
  7. $customer = Mage::getModel('customer/customer')->load($data->getCustomerId());
  8. $count = 0;
  9. foreach($load as $item)
  10. {
  11. $product = $item->getProduct();
  12. $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product->getId());
  13. $item_array[] = array(
  14. 'product_id' => $product->getId(),
  15. 'product_name' => $product->getName(),
  16. 'qty_ordered' => $item->getQty(),
  17. 'stock_available' => $stockItem->getIsInStock()
  18. );
  19. $count++;
  20. }
  21. if($count){
  22. $data_wishlist[] = array(
  23. 'customer_id' => $data->getCustomerId(),
  24. 'customer_email' => $customer->getEmail(),
  25. 'customer_name' => $customer->getFirstname() .' '. $customer->getLastname(),
  26. 'last_update' => $data->getUpdatedAt(),
  27. 'item_list' => $item_array
  28. );
  29. };
  30. }
  31. echo '<pre>';
  32. print_r($data_wishlist);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement