Jump to content


  • Posts

  • Joined

  • Last visited

Profile Information

  • First Name
  • Last Name

indigo380's Achievements


Newbie (1/14)




Community Answers

  1. In the end, I simplified my categories and what I really needed was to group the products by brand (my subcategories are now brand names). I was able to set this sorting option in... Shop Parameters > Product Settings and set "Default order by" to "Brand". So I didn't need the custom function at all. Also, I found out if you override the CategoryController to specify custom templates, then the template will not be used with faceted search nor with additional pages (?page=2). It reverts back to the original template. The way to get around this was to add this code to the top of templates/catalog/_partials/products.tpl {if $category.link_rewrite=='pumps' or $category.id_parent == 362} {include file='catalog/_partials/category/pumps.tpl' product=$product} {else} The new template (templates/catalog/_partials/category/pumps.tpl) was a modified version of template/catalog/_partials/products.tpl
  2. I would also like to know if the slider can be used for features. I have several sets of features with only numeric values and a slider like this would be perfect!!
  3. I have about a thousand products that we will be importing via csv. Each of these products has a different data sheet (PDF). How can I import the product with the file/attachment? I didn't see a way to do it via import or API. I would be open to any modules that could do this as well. Has anyone had any success with this before? I'm on Prestashop 1.7.
  4. So I decided to sort the product $listing variable by subcategory using array_multisort. I'm sure there is a better way but this works for now. The code below was placed in override/controllers/front/listing/CategoryController.php. <?php class CategoryController extends CategoryControllerCore { public function initContent() { parent::initContent(); // sort products so they are grouped by category $this->sortProductsByCategory(); } protected function sortProductsByCategory() { // get product listing $listing = $this->context->smarty->getTemplateVars('listing'); // find all categories in product listing $categories = array(); foreach ($listing['products'] as $product) { $categories[] = $product['id_category_default']; } // sort product listing by categories array_multisort($categories, SORT_ASC, $listing['products']); // send listing variable back to smarty template $this->context->smarty->assign( 'listing' , $listing ); } } ?> The problem with this solution is that it doesn't take into account the order of the subcategories. It is only sorting by ascending category id.
  5. Hi, I'm working with Prestashop 1.7 and I would like to have my products grouped by subcategory on a category page. So it should look something like this: Pumps (main category title) A Series (subcategory) Product 1 thumb Product 2 thumb Product 3 thumb B Series (subcategory) Product 4 thumb Product 5 thumb etc.... I figured out how to make a custom template by overriding the CategoryController. In the CategoryController, I created a function to build an array of products by subcategory (The array is called 'product_list' in the code below). This array gets passed to smarty, but it does not have all of the data (like images and features) that the original $listing variable has. protected function getSubcategoryProducts($parent_id) { $product_list = array(); $i = 0; // get all subcategories $subcategories = $this->category->getSubCategories($this->context->language->id); // get products by subcategory foreach ($subcategories as $subcategory) { $product_list[$i] = Product::getProducts($this->context->language->id, 0,0, 'id_product', 'ASC', $subcategory['id_category'], true); $i++; } // add all other products not in categories $product_list[$i] = Product::getProducts($this->context->language->id, 0,0, 'id_product', 'ASC', $parent_id, true); // make product_list available in smarty template $this->context->smarty->assign( 'product_list' , $product_list ); } There are other posts that ask for similar organization of products but the solutions are for <=1.6. (ie. https://www.prestashop.com/forums/topic/61907-displaying-all-products-from-subcategories-on-the-category-page/#comment-1278016) The problem I have is: 1. How do I create a variable like $listing (found in templates/catalog/listing/product-list.tpl) with all the image and feature data? Or how do I sort the $listing of products to group them by subcategory? I'm afraid that using getProducts in the code above will not work when filters are applied. Any thoughts on this?
  6. To change the length of the title go to the file: themes/default-bootstrap/modules/productscategory/productscategory.tpl find this code: {$categoryProduct.name|truncate:14:'...'|escape:'html':'UTF-8'} ...and change the number after 'truncate' to set the number of characters you want to show. For example, to set the length of the title to 30 characters: {$categoryProduct.name|truncate:30:'...'|escape:'html':'UTF-8'}
  7. I am getting closer... I am using Catalog Price Rules for the volume pricing and then Cart Rules to apply the additional options. This works because the Cart Rules are applied after the Catalog Price Rules, the additional fee is on top of the volume discounted price. The only problem is that Cart Rules only allow for price reductions and I need to increase the price by 10%, 20%, etc. Does anyone know how to increase prices with Cart Rules? Is that possible?
  8. The strike through price is working on the checkout page but not the product page. How do I get this to work with the javascript on the product page?
  9. Hi, I would like to know if it is possible to see a strike through original price with minimum quantities of 2 or more? When I set a specific price for a product and it has a minimum quantity of 1 and I can see the strike through discount. If I set the specific price to be applied for quantities of 2 or more, the price changes but there is no strike through original price. I would like this feature so that customers know they are getting a better deal if they buy more. How can I set this up?
  10. Hi, I would appreciate some advice on setting up product pricing for my client's website. They have various products with volume pricing in discounts of 10%. For example, a product with a base price of $100 has volume discounts like: Qty. 1 = $100 Qty. 2-3 = $90 Qty. 4-10 = $80 Qty. 11+ = $70 I was able to setup Specific Prices for these volume discounts. But I am unsure how to proceed with these same products that have both volume pricing and additional options with fees of 10%. This fee would be in addition to the volume pricing as such: Qty. 1 with additional option (+10%) = $110 Qty. 2-3 with additional option(+10%) = $99 Qty. 4-10 with additional option(+10%) = $88 Qty. 11+with additional option(+10%) = $77 And some of these products can have up to three additional options: Qty 1 with 2 additional options (+20%)= $120 Qty 1 with 3 additional options (+30%) = $130 etc.... I hope this example make sense. I think the easiest way would be to first apply the specific prices and then add the impact of the combination price, but I am new to Prestashop and it appears that if there is a specific price set then the combination impact is ignored. Is that right? Do you have any advice on how to setup this sort of pricing structure?
  • Create New...