♥raiwa 697 Posted November 18, 2018 4 hours ago, Rosyweb said: 1) Are you, when on your site - able to choose select Products and then choose' exclude Specials' and click save and it actually creates that code successfully and adds it to you list? 2) Then does that code follow through and work and actually exclude the specials when you try it out in cart view? many thanks I just checked and it works correct on this way. The problem may appear in a store with thousands of products. - The max. post size may be reached if thousands of products are selected. - the product list in the coupon listing will get very, very long (all discount products will be listed) - in ot_discount, the coding merges the product_id's array against the specials array. This may slow down page load if there are thousands of product id's. Even it works, it may not be useful for big stores with thousands of products. So it would be good in a future to try to add the functionality in the way specials could be excluded on the subtotal option. Then in ot_discount, if exclude specials is flagged, loop only through the ordered products and compare against specials and exclude them from discount. About Me: http://forums.oscommerce.com/user/249059-raiwa/ Share this post Link to post Share on other sites
Rosyweb 2 Posted November 18, 2018 1) On the one hand - that's brilliant Tsimi. Its allowed me to get it to work excluding specials. Can I just suggest putting a tiny bit of text on that page to say - please highlight products from the below list that you want included. It wasn't obvious that these actually needed highlighting and that it wouldn't work with them just listed there. 2) Yes I've run into the problem that Raiwa has identified above. The site has 1200 products. Not huge, but its a working site. The list only let me select up to J!! So half my products were left off. Is there any way of uping the max. post size. Where is this defined? thanks again! Share this post Link to post Share on other sites
♥raiwa 697 Posted November 18, 2018 (edited) 41 minutes ago, Rosyweb said: Is there any way of uping the max. post size. Where is this defined? This is a php.ini setting. It can be overwritten in .htaccess, but it depends on your hosting if it will work. You probably need to request your hosting to increase it. If you are on a shared server, it will be difficult. https://stackoverflow.com/questions/6135427/increasing-the-maximum-post-size Edited November 18, 2018 by raiwa About Me: http://forums.oscommerce.com/user/249059-raiwa/ Share this post Link to post Share on other sites
♥raiwa 697 Posted November 18, 2018 (edited) I tried on a test store with several thousand products and it seems there are more limitations for posting data. I couldn't get all products included even with post_max_size set o zero (no limit). It seems the limit for me is around 900 products. (xampp local develop installation) Here more info about: https://stackoverflow.com/questions/2364840/what-is-the-size-limit-of-a-post-request "The url portion of a request (GET and POST) can be limited by both the browser and the server - generally the safe size is 2KB as there are almost no browsers or servers that use a smaller limit. The body of a request (POST) is normally* limited by the server on a byte size basis in order to prevent a type of DoS attack (note that this means character escaping can increase the byte size of the body). The most common server setting is 10MB, though all popular servers allow this to be increased or decreased via a setting file or panel." Edited November 18, 2018 by raiwa About Me: http://forums.oscommerce.com/user/249059-raiwa/ Share this post Link to post Share on other sites
Rosyweb 2 Posted November 18, 2018 Ok so its never really going to work for most people on selecting all products then. But then of course I can set it on Manufacturers with excluding specials selected. That way I still cover all my products and exclude specials. I've done this. Although when I highlighted all manufacturers, when it created the code - it only listed the first (this got me worried) but actually it does work on all manufacturers products, and excludes specials. Great - some way to get it working. All the calculations are now correct as well! thanks for your time in helping me suss this out and working out whats possible and limitations also. It would still be great to sub-total after the discount etc applied, so I'll watch out in case that gets added later by yourself Raiwa or Lambros. The old discount codes I was using pre BS was ot_discount_coupon_codes_3_34_osc2.3_1_2_3. Share this post Link to post Share on other sites
♥Tsimi 505 Posted November 18, 2018 If you intend to select all products couldn't you use the select Categories feature? To select 1000 products or only 10 categories makes a big difference. That won't require such a large list up. 1 raiwa reacted to this Share this post Link to post Share on other sites
♥raiwa 697 Posted November 19, 2018 (edited) @Tsimi, @Rosyweb, I had a look on the coding and it was easier than I thought to add the exclude specials feature on subtotal discount. Can you give it a try and confirm if all works correct. Just replace these 2 files: - admin/discount_codes.php - includes/modules/order_total/ot_discount.php discount_codes.php ot_discount.php Edited November 19, 2018 by raiwa About Me: http://forums.oscommerce.com/user/249059-raiwa/ Share this post Link to post Share on other sites
♥raiwa 697 Posted November 19, 2018 OK, here is the ot_discount.php which should substract the discount from order subtotal if sort order is before order subtotal. NOTE: it will also substract shipping discount from subtotal. ot_discount.php About Me: http://forums.oscommerce.com/user/249059-raiwa/ Share this post Link to post Share on other sites
milerwan 21 Posted November 19, 2018 On 11/18/2018 at 3:35 PM, Tsimi said: To simply select all products just click the very first product and then scroll all the way down and hold the SHIFT button and click the last product on the list now all products within the list should be selected. Then click the save button. I think "Ctrl + A" is better way to select all products in a window. Osc v2.3.4 BS "custom" Share this post Link to post Share on other sites
milerwan 21 Posted November 19, 2018 (edited) 23 hours ago, Tsimi said: If you intend to select all products couldn't you use the select Categories feature? To select 1000 products or only 10 categories makes a big difference. That won't require such a large list up. In my case, I add a drop-down menu for categories excluded from the discount. This allows you to select fewer categories if just some are excluded and the rest of categories/products is concerned. PS: In this example, discount coupons are displayed from the customer area and show which categories are excluded. Edited November 19, 2018 by milerwan Osc v2.3.4 BS "custom" Share this post Link to post Share on other sites
Rosyweb 2 Posted November 20, 2018 Just replying to the test from Raiwa. I did copy those 2 files over and it did let me select Applies to Order sub-total and then select 'Exclude specials' BUT - the result, it didn't actually exclude the specials product I put in my cart along with others. Was I supposed to highlight anything? Here's my screenshot: Share this post Link to post Share on other sites
♥raiwa 697 Posted November 20, 2018 @Rosyweb, Can you please doublecheck and make shure you replaced the ot-discount module. On my test store it works. About Me: http://forums.oscommerce.com/user/249059-raiwa/ Share this post Link to post Share on other sites
♥Tsimi 505 Posted November 20, 2018 (edited) @raiwa Works like a charm for me. Well done! You came up very quickly with a solution for both requested features. I also tried with OT discount module before and after sub-total and it worked fine. Also tested prices with and without tax and also all good for me. @milerwan CTRL + A would usually work but it doesn't for this case. 😉 Edited November 20, 2018 by Tsimi Share this post Link to post Share on other sites
milerwan 21 Posted November 20, 2018 @Tsimi It's a shortcut known on Windows and it works in this case too. All rows are selected with it... Just test it. Osc v2.3.4 BS "custom" Share this post Link to post Share on other sites
♥Tsimi 505 Posted November 20, 2018 3 minutes ago, milerwan said: @Tsimi It's a shortcut known on Windows and it works in this case too. All rows are selected with it... Just test it. I did test it but it didn't work so I didn't mention it. Great if it works on your store. 1 raiwa reacted to this Share this post Link to post Share on other sites
milerwan 21 Posted November 20, 2018 4 minutes ago, Tsimi said: I did test it but it didn't work so I didn't mention it. Great if it works on your store. It's not a question of store, it's just a question of browser (Chrome, IE, firefox, Opera, etc). All work with this trick normally. Osc v2.3.4 BS "custom" Share this post Link to post Share on other sites
♥raiwa 697 Posted November 20, 2018 1 hour ago, Tsimi said: @raiwa Works like a charm for me. Well done! You came up very quickly with a solution for both requested features. I also tried with OT discount module before and after sub-total and it worked fine. Also tested prices with and without tax and also all good for me. Then I'll upload the update. Version number Discount_Codes_4.4.0_BS is ok ? 1 1 Tsimi and altoid reacted to this About Me: http://forums.oscommerce.com/user/249059-raiwa/ Share this post Link to post Share on other sites
♥Tsimi 505 Posted November 20, 2018 @raiwa Yes, the version number is OK. Share this post Link to post Share on other sites
♥raiwa 697 Posted November 20, 2018 Update uploaded: Version 4.4.0 BS: Added the possibility to exclude specials on order subtotal discounts. Added support to place ot discount module before ot subtotal module and show subtotal with discount amount substracted. 3 altoid, Tsimi and Peper reacted to this About Me: http://forums.oscommerce.com/user/249059-raiwa/ Share this post Link to post Share on other sites
Rosyweb 2 Posted November 22, 2018 Still having trouble getting mine to exclude specials, but if it works on everyone else's I must have missed something. So will try and suss out what I've got that is different. Share this post Link to post Share on other sites
sinopia 3 Posted December 7, 2018 Hello everyone. I'm having some issues to define some coupons for number of products. For examples: Coupon: EXAMPLE 1 -> 10% discount -> 1 product Coupon: EXAMPLE2 -> 20% discount -> 2 products Coupon: EXAMPLE3 -> 30% discount -> 3 products It's possible to use with "number of products to apply the discount" for all users and all products just defining like the example I gave? I tried everyting but it doesn't work.. Any help would be awesome. By the way, is there any change to anyone add a coupon only for a certain attribute? Share this post Link to post Share on other sites
♥raiwa 697 Posted December 7, 2018 (edited) The option " Number of products to apply the discount: " is only available for discounts on specific products or categories or manufacturers, not for subtotal discounts. You have to use: Applies to: Products or Categories or Manufacturers and select the products/categories/manufacturers you wish to include. Selecting all categories or manufacturers is a trick if you wish to use it for all products. See previous posts about the exclude specials problem. For me it works all as expected. It applies to the amount of products as entered. 14 minutes ago, sinopia said: By the way, is there any change to anyone add a coupon only for a certain attribute? No, I don't think so. It is not planned. Edited December 7, 2018 by raiwa About Me: http://forums.oscommerce.com/user/249059-raiwa/ Share this post Link to post Share on other sites
sinopia 3 Posted December 7, 2018 Hello @raiwa thank you for your answer. I did selected all products and even categories (I don't use manufacturers). The coupon "EXAMPLE3" works always if I have 1 product or 3 products for example, shouldn't it only be valid if 3 products or more are in the cart? About the attributes I think that a good idea and also some shops are using that way... Thank you, I'll check about the excluded specials problem, that can be my issue. Share this post Link to post Share on other sites
sinopia 3 Posted December 7, 2018 Can't fix it, in the version I had I set the javascript at checkout_payment manually and not at header_tags, the discount code works normally but I get this error at console: Uncaught ReferenceError: $ is not defined $.post("discount_code.php", {discount_code: $("#discount_code").val()}, function (data) { But even with the old one it check correct the discount code but should apply for 3 products as I've set it on admin/discount_codes.php I've been reading everything but nothing is solving my problem. Share this post Link to post Share on other sites
♥raiwa 697 Posted December 7, 2018 Did you check the radio button "products" or "categories" instead of "subtotal"? Can you please post a screenshot with an example (both, admin and checkout confirmation). I checked again and it works for me for 2 products: NOTE: Mouse and graphic card gets discounted. About Me: http://forums.oscommerce.com/user/249059-raiwa/ Share this post Link to post Share on other sites