Jump to content

xrichardt

Members
  • Posts

    3
  • Joined

  • Last visited

xrichardt's Achievements

Newbie

Newbie (1/14)

  • Week One Done Rare
  • One Month Later Rare
  • One Year In Rare

Recent Badges

0

Reputation

  1. Solution: upgrade to latest Prestashop (a lot has been improved!), or, if you cannot upgrade, update only indexation functions Search in my Prestashop 1.4.2.5. broke down recently (slow, inclomplete, problems with accented characters). I was searching for a solution, noticed that ps_search_index has incomplete results etc. Next, I noticed a lot has been improved in latest version of Prestahop regarding search (see changelogs). In my case, I couldn't upgrade (my shop is heavily customised), the solution for me was to update indexation functions only, it works great since – what you have to do is to download the latest Prestashop and replace current and add a couple of new functions: Classes/Search.php replace public static function indexation add protected static function getProductsToIndex Classes/Tools.php add public static function replaceAccentedChars
  2. There are two solutions for Data truncated for column 'condition' at row ... error. (using Prestashop 1.4.2.5) First, what is the cause of the error: product condition cannot be imported, yet, the import procedure effectively passes an empty string as condition which causes an error in MySQL where condition column of ps_product table is of enum('new','used','refurbished') type (and even if NULL value for the column is enabled, it still causes the same error, because empty string does not equal to NULL in MySQL) Solution #1 (as suggested above): allow empty string for condition column i.e. change the type to: enum('new','used','refurbished','') -> this solution seem to work, but is not ideal, because an empty condition state is not consistent with Prestashop – this can cause problems elsewhere ... Solution #2: set default value for condition column in import method by adding line 'condition' => 'new' anywhere to self::$default_values method in AdminImport.php (around line 178) like this: self::$default_values = array( 'id_category' => array(1), 'id_category_default' => 1, 'active' => '1', 'quantity' => 0, 'price' => 0, 'id_tax_rules_group' => 0, 'description_short' => array((int)(Configuration::get('PS_LANG_DEFAULT')) => ''), 'link_rewrite' => array((int)(Configuration::get('PS_LANG_DEFAULT')) => ''), 'condition' => 'new', 'online_only' => 0);
  3. The post above by aleonzzz is now obsolete and it made me think about a new solution – – the code bellow sets 'active' atribute of a product to 0 (effectively making it disabled from cataloque) at the time new order is placed as soon as the quantity drops bellow 1 ... (obvously it requires to have Stock Management ON) (works with Prestashop 1.4.2.5; not yet fully tested – I'm new to Prestashop ...) File: Classes/PaymentModule, line 183, add section marked /* disable product when quantity bellow one */ if ($id_order_state != _PS_OS_CANCELED_ AND $id_order_state != _PS_OS_ERROR_) { if (Product::updateQuantity($product, (int)$order->id)) $product['stock_quantity'] -= $product['cart_quantity']; /* disable product when quantity bellow one */ if ($product['stock_quantity'] < 1) { $query2 = 'UPDATE `'._DB_PREFIX_.'product` SET `active`=0 WHERE `id_product`='.$product['id_product']; $db->Execute($query2); } if ($product['stock_quantity'] < 0 && Configuration::get('PS_STOCK_MANAGEMENT')) $outOfStock = true;
×
×
  • Create New...