PrestaShop Forum

The best place in the world to ask questions about PrestaShop and get advice from our passionate community!

PrestaShop Forum

Jump to content

 

Product Page Error

36 replies to this topic
#1
tekexplore

    PrestaShop Newbie

  • Members
  • Pip
  • 18 posts
I imported 10000 product to my store after importing I am getting the following error when I try to open the product landing page


Fatal error: Allowed memory size of 88080384 bytes exhausted (tried to allocate 46 bytes) in [link] on line 2196

Any idea to fix?

--

#2
rocky

    PrestaShop Superstar

  • US Moderators
  • 9988 posts
Try uninstalling the "New products" module or any other modules that may try to get all the products at one time.
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

#3
tekexplore

    PrestaShop Newbie

  • Members
  • Pip
  • 18 posts
Yup. I tried by un-installing the following module

Products Category v1.2.1
Display products of the same category on the product page

Now it working fine. But again when I install the module I get the same error. Any fix?

#4
tekexplore

    PrestaShop Newbie

  • Members
  • Pip
  • 18 posts
I am also not getting the Recently Viewed Products in my shop... any idea????

#5
rocky

    PrestaShop Superstar

  • US Moderators
  • 9988 posts
The recently viewed products are stored in PrestaShop's cookie, whether or not the customer is logged in. I don't know why they wouldn't work, unless cookies aren't working on your site, but then customers wouldn't be able to log in at all.
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

#6
rocky

    PrestaShop Superstar

  • US Moderators
  • 9988 posts
By default, the "In the same category" gets 30 products in the same category. You could try reducing that number. For example, change line 51 of modules/productscategory/productscategory.php from:


$sizeOfCategoryProducts = $category->getProducts(intval($cookie->id_lang), 1, 30, NULL, NULL, true);


to:


$sizeOfCategoryProducts = $category->getProducts(intval($cookie->id_lang), 1, 10, NULL, NULL, true);


and lines 84-89 from:


// If products tab higher than 30, slice it
if ($sizeOfCategoryProducts > 30)
{
$categoryProducts = array_slice($categoryProducts, $middlePosition - 15, 30, true);
$middlePosition = 15;
}


to:


// If products tab higher than 10, slice it
if ($sizeOfCategoryProducts > 10)
{
$categoryProducts = array_slice($categoryProducts, $middlePosition - 5, 10, true);
$middlePosition = 5;
}

Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

#7
tekexplore

    PrestaShop Newbie

  • Members
  • Pip
  • 18 posts
I tired your code now the page gets loaded with Products Category module but its taking huge time(>1 Min) to load the product page. Any comments??

Also Kindly see to the attachment which this thread. I got the error message when I tried to import products to the shop I dont know why so many products were not able to load into the store though all single and double quotes in all names and descriptions i mentioned as HTML Ascii code so that it wont clash with MySQL Syntax. Any fix for this?

Attached Files



#8
rocky

    PrestaShop Superstar

  • US Moderators
  • 9988 posts
I can't reproduce the problem with the "In the same category" module, but I don't have a huge number of products in any one category. It is the SQL query in the getProducts() function of classes/Category.php that gets the products. I guess it isn't efficient for huge catalogs. Perhaps it would be more efficient to split it into two queries, one that gets selects the categories and then one that joins all the tables together, instead of the current single query that joins all the tables together, then selects the categories.

The reason those product names are failing may be because they are longer than 128 characters, which is the maximum a product name is allowed to be, or they have symbols that are not allowed. What version of PrestaShop are you using? I'm using PrestaShop v1.3.1 and looking at the code, only <>;=#{} are not allowed. It seems many of those failed named have an ' or : though. If you are using an older version of PrestaShop, perhaps one of them is being disallowed.
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

#9
tekexplore

    PrestaShop Newbie

  • Members
  • Pip
  • 18 posts
I will try by modifying the query for "In the same category" as you said; and for the import issue, I am using latest stable version and many products with : is imported and also for ` i have converted to HTML code and then imported.

How do I change the character limit for Product Name. and what will be the best solution for me to upload product with :, ;, [] characters.

#10
rocky

    PrestaShop Superstar

  • US Moderators
  • 9988 posts
In my PrestaShop v1.3.1 installation, It is the isCatalogName() function in classes/Validate.php that checks for invalid characters in the product name:


return preg_match('/^[^<>;=#{}]*$/ui', $name);


You can change it to the following to allow ; in your product names:


return preg_match('/^[^<>=#{}]*$/ui', $name);


To change the character limit is difficult. You will need to edit your database using phpMyAdmin and increase the size of the 'name' field in the 'ps_product' table from 128 to however many characters you need. Then edit classes/Product.php and change line 188:


'meta_title' => 128, 'link_rewrite' => 128, 'name' => 128, 'available_now' => 255, 'available_later' => 255);


Change the 128 after 'name' to the maximum number of characters you changed the name to be in the database.
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

#11
tekexplore

    PrestaShop Newbie

  • Members
  • Pip
  • 18 posts
Fine will try now. By the way how about the character length. How can I increase the character length. I changed the field size in back-end any changes required in code-level.

#12
rocky

    PrestaShop Superstar

  • US Moderators
  • 9988 posts
See my previous post to increase the product name character limit. I updated it after posting and realising that I forgot to answer both your questions. I guess you only saw my first answer.
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

#13
tekexplore

    PrestaShop Newbie

  • Members
  • Pip
  • 18 posts
Cool.. Have got it now. Will try and let you know. Once I am done with all stuff i will share the store link for showcase :) Prestashop Rocks ...

#14
tekexplore

    PrestaShop Newbie

  • Members
  • Pip
  • 18 posts
How can I display price including tax.

When I use $product->price leads to same output as $product_wholesale_price why so?

#15
rocky

    PrestaShop Superstar

  • US Moderators
  • 9988 posts
I have no idea. Try using $product->getPrice(true) instead.
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

#16
tekexplore

    PrestaShop Newbie

  • Members
  • Pip
  • 18 posts
I want the value price with tax value in smarty I am calling all values from product object from PHP in foreach loop.

Also I have one more query.

In home page I implemented JQuery Tabs to each category for featured products now I want to display featured product for each category separately how to achieve this.

Now I am using


$category = new Category(1);

$products = $category->getProducts(1, 1, 6);
$smarty->assign(array('products' => $products, 'homeSize' => Image::getSize('home')));


This returns all the homefeatured products under all categories but I need for specific category.

#17
rocky

    PrestaShop Superstar

  • US Moderators
  • 9988 posts
Try the following:


$categories = Category::getSimpleCategories($params['cookie']->id_lang);
$products = array();

foreach ($categories as $category)
{
$categoryObj = new Category($category['id_category'], $params['cookie']->id_lang);
$products[$category['id_category']] = $categoryObj->getProducts($params['cookie']->id_lang, 1, 6);
}

$smarty->assign(array('cat_products' => $products, 'homeSize' => Image::getSize('home')));


This code will get the first 6 products from every category. You can then use code like the following in homefeatured.tpl:


{foreach from=$cat_products key=id_category item=products}


    {foreach from=$products item=product}
  • Product code goes here

  • {/foreach}


{/foreach}

Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

#18
tekexplore

    PrestaShop Newbie

  • Members
  • Pip
  • 18 posts
I tried the above code its not returning any products.

#19
rocky

    PrestaShop Superstar

  • US Moderators
  • 9988 posts
It's working on my test site. I don't know why it isn't working for you.
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

#20
tekexplore

    PrestaShop Newbie

  • Members
  • Pip
  • 18 posts
Cool. Found the issue and fixed thanks a ton. I have few queries.

1. I want to mask the "Your Address" section from the registration page. I want to get only Email and Password alone in registration time remaining fields can be updated at any time from My Profile page

2. I want to have the friendly URL as /ean13-title-reference.html not like /id_product-title-reference.html How can I achieve this.