Jump to content

cm_a93

Members
  • Posts

    3
  • Joined

  • Last visited

Profile Information

  • First Name
    Ashfaq
  • Last Name
    Afzal

cm_a93's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hi all, I am using zero supermarket sidebar on my store. I want the module to select random products to display. This is what I think should be modified if ($zsidebarsuperblock['block_type'] == _SBTPRODUCT_) { $zsidebarsuperblock['product_options'] = ZSidebarSuperBlock::initProductOptions($zsidebarsuperblock['product_options']); $products = false; $limit = (int)$zsidebarsuperblock['product_options']['limit']; $random = false; $order_by = $zsidebarsuperblock['product_options']['order_by']; if ($order_by == 'random') { $random = true; $order_by = null; } if ($zsidebarsuperblock['product_filter'] == _SPTFEATURES_) { $category = new Category(Context::getContext()->shop->getCategory(), $id_lang); $products = $category->getProducts($id_lang, 1, $limit, $order_by, 'ASC', false, $random, $limit); } elseif ($zsidebarsuperblock['product_filter'] == _SPTNEW_) $products = Product::getNewProducts($id_lang, 0, $limit); elseif ($zsidebarsuperblock['product_filter'] == _SPTSPECIAL_) $products = Product::getPricesDrop($id_lang, 0, $limit); elseif ($zsidebarsuperblock['product_filter'] == _SPTSELLER_) $products = ProductSale::getBestSales($id_lang, 0, $limit, 'date_add'); elseif ($zsidebarsuperblock['product_filter'] == _SPTSELECTED_) $products = $this->getProductByArrayId($id_lang, $zsidebarsuperblock['product_options']['selected_products']); elseif ($zsidebarsuperblock['product_filter'] == _SPTCATEGORY_) { $category = new Category((int)$zsidebarsuperblock['product_options']['selected_category'], $id_lang); $products = $category->getProducts($id_lang, 1, $limit, $order_by, 'ASC', false, $random, $limit); if ($products) { shuffle($products); array_splice($products, ($nb ? $nb : 10)); } } $blocks[] = array( 'title' => $zsidebarsuperblock['title'], 'block_type' => $zsidebarsuperblock['block_type'], 'custom_class' => $zsidebarsuperblock['custom_class'], 'number_column' => $zsidebarsuperblock['product_options']['number_column'], 'products' => $products, ); } Can anyone tell me how to modify it to select random products
  2. Hi, I know my question is stupid but I need to solve this problem. I have a foreach loop that is showing products in a block. What I need to get is, the link to the sub categories (one by one in each iteration) of the parent category from that the product belongs to. I mean, for the first iteration of this foreach loop, I will get the link to first sub-category and for second iteration I will grab the link to second sub-category and so on. Can anybody tell me how I can do this? Thanks in Advance!
  3. Hi, I am new to PrestaShop. I am trying to get an array of sub-categories using parent category id, so I can refer to the different sub-category in different circumstances. Actually, I want to place an if statement in a foreach loop and check if its the first iteration of the loop then grab the link of 1st sub-category enlisted and if it's 2nd iteration then grab the link of 2nd sub-category and so on. Can anybody help me? Thanks in advance! and sorry for my bad English.
×
×
  • Create New...