Jump to content


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

vasikgreif's Achievements


Newbie (1/14)



  1. Hi, I would need to do some minor change in setLastInvoiceNumber() function in Order.php class. Is there a way to override just this function? I mean, if I copy the whole Order.php to overrides/classes/order/Order.php, I will override the whole class, which is kind of overkill and makes updating PS harder I guess...
  2. This is not solved - commenting out the line in product.js leads to combinations not working. Anyone can point me to what to change in the product.js to make this work correctly?
  3. Thanks for the link! I think I have it working on PS 1.6. In Product.php I changed the line $specific_price_reduction = !$use_tax ? $product_tax_calculator->removeTaxes($reduction_amount) : $reduction_amount; to $specific_price_reduction = floatval($reduction_amount); I also had to switch the product price display under Customers - Groups to "Tax ecl.", as without that the tax got calculated wrong. The last thing I did was commenting following line in themes/default-bootstrap/js/product.js, to display the price correctly on tyhe products page //$('#our_price_display').text(our_price); I have to test this solution more, to confirm it's really fully working.
  4. Is there a way to apply amount based specific price before the tax is applied? I mean Product price $10 => discount $2 = $8 => with 10% tax $8.8 instead of Product price $10 => with 10% tax $11 => discount $2 => total $9 I found many threads about this issue, and didn't find any solution.
  5. Glad it will get some use..:-) I'm using this for PS 1.6....
  6. 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>
  7. I'm about to start my eshop, and run into trouble. I have a product, that has two combinations: I'll return old part: YES NO If the customer selects NO, 30Eur is added to the price. Now, I have some special prices on the product, and would need to aply the discount to the original price. Ie., I have product that costs 100EUR and the discount of 30%. If the user selects YES, the price is correct, 70EUR. But, if he selects NO, the price is (100EUR+30EUR) - 30%. I would need to have it (100EUR - 30%) + 30EUR. Is there a way to do this?
  8. This should be easy, but I cannot find an answer - how can I import attributes of my products from CSV file? I know I can import combinations, but that's not what I need (at least I think) - I just need to have technical specifications on each product. Am I missing something? Thanks
  9. Zdravím, existuje někde modul (i placený), který zobrazí shrnutí objednávky před potvrzením? Vracím se po několika letech k Prestashopu a znovu řeším ty samé problémy..:-) Díky
  10. Thanks for the mod. It doesn't seem to allow to pick different files for different combinations though, which is kind of basic requirement for downloadable products. Any chance to make this work? Thanks!
  11. Don't have time now to post full code, but the code necesarry for the email validation can be found here: http://stackoverflow.com/questions/2507030/email-validation-using-jquery
  12. Well, I tried $("#submitAccount").click(function() { if($(".error").is(':hidden')) { $('#opc_payment_methods').show(); } }); which should check if the error div is hidden, and if so, display the shipping, but for some reason this doesn't work - if someone is able to make it work, it would be the best way, I think. What works to some extent is to check if the fields contain a value, if so, reveal the shipping. This is not that great solution, because it doesn't check, if the value is valid. Anyway, the code looks like (feel free to add other fields if you want to use this): $("#submitAccount").click(function() { if($("#email").val() && $("#customer_firstname").val() && $("#customer_lastname").val() ) { $('#opc_payment_methods').show(); } });
  13. Ok, here's better version of that. Uses jQuery only: <script> $( document ).ready( function() { if($(".address_delivery").length == 0) { $('#opc_payment_methods').hide(); $("#submitAccount").click(function() { $('#opc_payment_methods').show(); }); } $("#openLoginFormBlock").click(function() { $('#opc_payment_methods').show(); }); }); </script>
  14. I solved this by a little bit of jquery and css: add to order-opc.css: #opc_payment_methods {display: none;} add to order-opc.tpl: <script> $( document ).ready( function() { if($(".address_delivery").length == 0) { $("#submitAccount").click(function() { $('#opc_payment_methods').show(); }); } else { $('#opc_payment_methods').show(); } }); </script> In order-payment.tpl I moved the line <div id="opc_payment_methods" class="opc-main-block"> before {if !$opc}<h1>{l s='Choose your payment method'}</h1>{else}<h2><span>2</span> {l s='Choose your payment method'}</h2>{/if} So, basically when doing guest checkout, the payment div is hidden unless clicked on the save button, when registering, the payment div is displayed right away. There might be better way to do this (I'm no way an expert), but this seems to work fine for me.
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More