Jump to content

V1.1 some bugs fixes


Recommended Posts

Here are some bugs fixes for V1.1 Original French Post HERE

--------------------------------------------------------

http://www.prestashop.com/bug_tracker/view/1091/

Cart truncate:

in /modules/blockcart/blockcart.tpl line: 44
find:

{$product.name|escape:htmlall:'UTF-8'|truncate:20} 


replace:

{$product.name|escape:htmlall:'UTF-8'|truncate:16}



in /modules/blockcart/blockcart-json.tpl line: 77
find:

'{$error|addslashes}' 


replace:

'{$error|addslashes|html_entity_decode:2:'UTF-8'}'



--------------------------------------------------------

http://www.prestashop.com/forums/viewthread/9858/discussion_generale/probleme_de_stat_depuis_le_1er_janvier_2009

Stat problem

in /admin/tabs/AdminStatsTab.php line: 36
find

if ($month = Tools::getValue('dateInputMonth', -1) AND Validate::isUnsignedInt($month))


replace

if (($month = Tools::getValue('dateInputMonth', -1)) != -1 AND Validate::isInt($month))



--------------------------------------------------------

http://www.prestashop.com/bug_tracker/view/1080/

in /modules/cheque/cheque.php line: 33

find:

if (!isset($this->address) OR !isset($this->address))


replace:

if (!isset($this->chequeName) OR !isset($this->address))



--------------------------------------------------------

http://www.prestashop.com/bug_tracker/view/1059/

problem with customised product in BO

in /admin/tabs/AdminProduct.php line: 422

find:

$product->customizable = (intval($_POST['uploadable_files']) > 0 OR intval($_POST['text_fields']) > 0) ? true : false;


replace:

$product->customizable = (intval($_POST['uploadable_files']) > 0 OR intval($_POST['text_fields']) > 0) ? 1 : 0;



--------------------------------------------------------

http://www.prestashop.com/bug_tracker/view/1155/
pagination bug in new-products.php

Details:
On new-products page. Pagination block don't show the good number of page.
If there is 3 new-products and 60 products in the database, 3 products are displayed (that good) but there is a link for

each page (1, 2, 3, 4, ... 6) [with the default display 10 products by page].

To correct this bug, In the new-product.php page:

Ok, there is the new correction:

The original file was good:

line 8:

$nbProducts = intval(Product::getNewProducts(intval($cookie->id_lang), NULL,NULL, true));



but in classes/Products.php, getNewProducts was not good
find line 903:

        if ($count)
       {
           $result = Db::getInstance()->getRow('
           SELECT COUNT(`id_product`) AS nb
           FROM `'._DB_PREFIX_.'product`
           WHERE `active` = 1');
           return intval($result['nb']);
       }



replace:

        if ($count)
       {
           $result = Db::getInstance()->getRow('
           SELECT COUNT(`id_product`) AS nb
           FROM `'._DB_PREFIX_.'product`
           WHERE `active` = 1
           AND DATEDIFF(`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0');
           return intval($result['nb']);
       }



Because original count return the number of products on database instead of the number of new products.


----------------------------------------------------------

about products accessories that can't be set off, a tip is given in this post
http://www.prestashop.com/forums/viewthread/10492/#48055

in file js/admin.js comment:

/*console.log('---');
console.log(input);
console.log('___');
 console.log(name);*/



About accessories, it's a browser bug , console.log let by devs create bugs with some browsers, not FF2 but FF3 . take off all console.log from javascripts code.
Link to comment
Share on other sites


We ask that you please post in English to the main sections of the PrestaShop Forum.


Thanks for you help, the problem is that 80% of us do not speak any French so if you could translate this to English then please :-)

Edit: aha, I see now, you added the link to the bug-rapport. Thanks!
Link to comment
Share on other sites

Patch for little pictures bug not changed in BO

Thanks Pshopexpert LOOK HERE

IN /admin/tabs/AdminProducts.php

FIND line 176

if (isset($_GET['deleteImage']))
               {
                   $image->delete();
                   deleteImage($image->id_product, $image->id);
                   if (!Image::getCover($image->id_product))
                   {
                       $first_img = Db::getInstance()->getRow('
                       SELECT `id_image` FROM `'._DB_PREFIX_.'image`
                       WHERE `id_product` = '.intval($image->id_product));
                       Db::getInstance()->Execute('
                       UPDATE `'._DB_PREFIX_.'image`
                       SET `cover` = 1
                       WHERE `id_image` = '.intval($first_img['id_image']));



ADD AFTER

@unlink(dirname(__FILE__).'/../../img/tmp/product_'.$image->id_product.'.jpg');
@unlink(dirname(__FILE__).'/../../img/tmp/product_mini_'.$image->id_product.'.jpg');



FIND line 209

elseif (isset($_GET['coverImage']))
               {
                   Image::deleteCover($image->id_product);
                   $image->cover = 1;
                   $image->update();



ADD AFTER

@unlink(dirname(__FILE__).'/../../img/tmp/product_'.$image->id_product.'.jpg');
@unlink(dirname(__FILE__).'/../../img/tmp/product_mini_'.$image->id_product.'.jpg');



FIND line 509

public function addProductImage($product, $method = 'auto')



TAKE OFF UNLINK lines 529

@unlink(dirname(__FILE__).'/../../img/tmp/product_'.$product->id.'.jpg');
@unlink(dirname(__FILE__).'/../../img/tmp/product_mini_'.$product->id.'.jpg');



REPLACE WITH

if (sizeof($this->_errors))
           return false;
       @unlink(dirname(__FILE__).'/../../img/tmp/product_'.$product->id.'.jpg');
       @unlink(dirname(__FILE__).'/../../img/tmp/product_mini_'.$product->id.'.jpg');
       return ((isset($id_image) AND is_int($id_image) AND $id_image) ? $id_image : true);

Link to comment
Share on other sites

Bonsoir

MAJ effectuées ;-) : super idée que cette liste !

Juste une question sur la correction des "false/true" en "0/1" : dans le même fichier ligne 73 on n'aurait pas le même soucis par hasard ?... Je dis ça je dis rien, juste que je n'ai jamais utilisé de booléens sous cette forme en PHP, je pose donc la question ;-)

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...
  • 1 month later...

Correction of the bug #1549: removing customized products from the cart (see forum and bug tracker).

Here are the modifications brought to the cart.php file on my Prestashop version (SVN 687):

1/ Look for:

private function _updateCustomizationQuantity($quantity, $id_customization, $id_product, $id_product_attribute, $operator = 'up')


Line 416, replace:

return $this->_deleteCustomization(intval($id_customization));


with:

return $this->_deleteCustomization($id_product,intval($id_customization),$id_product_attribute);



2/ Look for:

public    function deleteProduct($id_product, $id_product_attribute = NULL, $id_customization = NULL)


Line 495, replace:

return $this->_deleteCustomization(intval($id_customization)) AND $this->deleteProduct(intval($id_product), $id_product_attribute, NULL);


with:

$this->_deleteCustomization($id_product,intval($id_customization),$id_product_attribute) AND $this->deleteProduct(intval($id_product), NULL, $id_product_attribute);



3/ Look for:

private    function _deleteCustomization($id_customization)


Lines 515 to 519, replace:

    private    function _deleteCustomization($id_customization)
   {
       if (!$result = Db::getInstance()->getRow('SELECT `quantity` FROM `'._DB_PREFIX_.'customization` WHERE `id_customization` = '.intval($id_customization)) OR 
           !Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'cart_product` SET `quantity` = `quantity` - '.intval($result['quantity'])))
           return false;


with:

  private    function _deleteCustomization($id_product, $id_customization, $id_product_attribute=NULL)
   {
   if (!$result = Db::getInstance()->getRow('SELECT `quantity` FROM `'._DB_PREFIX_.'customization` WHERE `id_customization` = '.intval($id_customization)) OR
       !Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'cart_product` SET `quantity` = `quantity` - '.intval($result['quantity']).' WHERE `id_product`='.intval($id_product).' AND `id_cart` = '.intval($this->id).' AND `id_product_attribute` = '.($id_product_attribute != NULL ? intval($id_product_attribute) : '\'\'')))
           return false;

Link to comment
Share on other sites

  • 8 months later...
  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...