Search the Community
Showing results for tags 'special prices'.
-
Hello Im looking for a solution on this problem.My company has diferent prices - 1 its for regular customers and the second is for special customers and the 3-rd one is the price witch we buy the product for. Ive created two diferent groups (Regular customers and second is Specific Customers) and ive imported all clients to the groups. I want when the customer logs in to see his price according to the group. Example Regular customer - 4 $ Specific Customer - 2$ Im not talking about the disscount in specific price,the prices are fixed.I m talking about 7k products and 5k customers. Is it posible to add another field or even more than one to the products in version 1.6.1.24? Our warehouse's web witch im trying to improve is using Prestashop 1.4.0 and there they have 4 fields for price's (see picture below) And its connected to the groups. If you have any sugestions ...? I have started the new project on 1.6.1.24 - Because the latesest version of Prestashop has a problem with the latin lang.*Bulgarian*(everything gets in symbols)
-
For anyone interested, here's a super simple script I created to be ale to import specific prices from csv, as I didn't find any other way to do this. NOTE: This is definitely a hack and not a proper way to extend Prestashop! The script as is has bunch of security issues, like no authentification, close to no validation etc. However, it works well for me (I enabled access to the file from my IP only and I'm the one who's creating the csv and doing the import). I created this script to make my life easier with handling specific prices, and it made it...:-) USE AT YOUR OWN RISK NOTE 2: The csv fields in this example are be product_id, group, percentage_discount, value_discount Either percentage_discount or value_discount should be filled NOTE 3: The script can be easily extended to handle more fields, anyone with basic PHP skills will know how to do that. It is also easy to add more fields into the form to have some settings, like csv separator, setting csv columns -> db columns combos etc. <?php $csv = array(); // check that there are no errors if($_FILES['csv']['error'] == 0){ $name = $_FILES['csv']['name']; $ext = strtolower(end(explode('.', $_FILES['csv']['name']))); $type = $_FILES['csv']['type']; $tmpName = $_FILES['csv']['tmp_name']; // check the file is a csv if($ext === 'csv'){ if(($handle = fopen($tmpName, 'r')) !== FALSE) { // I'm using meekrodb - http://www.meekro.com/ - normally, Prestashop framework should be used to access the db, but I have no time to learn it now..:-) require_once 'meekrodb.php'; DB::$user = 'dbuser'; DB::$password = 'dbpass'; DB::$dbName = 'dbname'; DB::$host = 'dbhost'; // delete all specific prices, to reimport them later DB::delete('ps_specific_price','id_specific_price != 0'); // necessary if a large csv file set_time_limit(0); $row = 0; while(($data = fgetcsv($handle, 1000, ',')) !== FALSE) { // number of fields in the csv $num = count($data); // get the values from the csv $product_id = $data[0]; $group = $data[1]; $reduction_percent = $data[2]; $reduction_amount = $data[3]; // get reduction - either percent or amount $reduction = $reduction_percent != '' ? $reduction_percent : $reduction_amount; if ($reduction_percent != '') $reduction_type = 'percentage'; if ($reduction_amount != '') $reduction_type = 'amount'; // if group = 0 (Everybody), delete all other discounts, as the discounts in PS are cumulative, and I don't want to give my customers 120% discount... if ($group == 0) { DB::delete('ps_specific_price', "id_product=%s", $product_id); } // check, if there's some discount with group = 0, if so, don't import, for the same reason as above $discount = DB::queryFirstRow("SELECT * FROM ps_specific_price WHERE id_product=%s AND id_group = 0", $product_id); if (is_null($discount)) { DB::insert('ps_specific_price', array( 'id_specific_price_rule' => 0, 'id_cart' => 0, 'id_product' => $product_id, 'id_shop' => 0, 'id_shop_group' => 0, 'id_currency' => 0, 'id_country' => 0, 'id_group' => $group, 'id_customer' => 0, 'id_product_attribute' => 0, 'price' => '-1.000000', 'from_quantity' => 1, 'reduction' => $reduction, 'reduction_type' => $reduction_type, 'id_country' => 0, 'from' => '0000-00-00 00:00:00', 'to' => '0000-00-00 00:00:00' )); } // inc the row $row++; } fclose($handle); echo 'CSV was imported sucessfully'; } } } ?> <html> <body> <form action="" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="csv" id="csv"><br> <input type="submit" name="submit" value="Submit"> </form> </body> </html>
-
Layered navigation block module can’t filter special prices with reduction on prestashop 1.5.2. Is it possible to solve this without an update? I really appreciate any help you can provide.
-
Hello everybody! I am new in the PrestaShop world, and I need some help: I would like to set a special price in all the products that could only be seen by registered users with their personal VAT Number (in Italy is called "Partita Iva / P.IVA"). The products will be the same, but for these users the price will be different: lower than the "normal user / private ones". Is it possible to do? Thanks in advance!