PrestaShop Forums: Product Page Error - PrestaShop Forums

Jump to content


Welcome to the PrestaShop Forum! We hope you'll share your comments and suggestions with us. We ask that you please post in English to the main sections of the PrestaShop Forum. If you want to write in another language, please post in the corresponding PrestaShop Community section below.

Please note that PrestaShop Community sections are largely self-moderated. PrestaShop team members may or may not participate in non-English sections. To improve the chances of receiving feedback to your question or comment, please post it in English to the main sections of our Forum.

NYC

Vous parlez français ? par ici !


Product Page Error


Product Page Error

#1 tekexplore

    PrestaShop Newbie

  • 28 Aug 2010
  • Members
  • Pip
  • 18 posts

Posted 05 September 2010 - 11:44 AM

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

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 05 September 2010 - 01:08 PM

Try uninstalling the "New products" module or any other modules that may try to get all the products at one time.

#3

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 05 September 2010 - 01:24 PM

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

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 06 September 2010 - 04:24 AM

I am also not getting the Recently Viewed Products in my shop... any idea????

#5

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 06 September 2010 - 04:31 AM

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.

#6

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 06 September 2010 - 08:51 AM

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;
}


#7

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 06 September 2010 - 02:27 PM

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 File(s)



#8

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 07 September 2010 - 01:50 AM

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.

#9

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 07 September 2010 - 04:13 AM

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

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 07 September 2010 - 04:45 AM

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.

#11

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 07 September 2010 - 05:15 AM

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

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 07 September 2010 - 05:23 AM

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.

#13

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 07 September 2010 - 05:27 AM

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

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 08 September 2010 - 07:28 PM

How can I display price including tax.

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

#15

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 09 September 2010 - 01:26 AM

I have no idea. Try using $product->getPrice(true) instead.

#16

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 09 September 2010 - 03:13 AM

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

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 09 September 2010 - 05:02 AM

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}


#18

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 09 September 2010 - 05:51 AM

I tried the above code its not returning any products.

#19

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 09 September 2010 - 06:18 AM

It's working on my test site. I don't know why it isn't working for you.

#20

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 09 September 2010 - 04:45 PM

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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users