Jump to content

[CONTRIBUTION] Better Together Discounting Module


Recommended Posts

I just have made the download and i will try in localhost and then will give my opinion :)

Thanks for the contribution ;-)

If you want you can see my contributions in my signature.

Best Regards

Share this post


Link to post
Share on other sites

Hi thanks for this, I have noticed that this is only compatible with 1.2, is there anyway that you can make this comaptible to 1.1 as we cannot currently upgrade due to custom database changes.

We will be more than happy to make a donation if you are able to make it compatible with 1.1

Many thanks

Share this post


Link to post
Share on other sites

This is a great module, although is there a future with it working with the AJAX cart?

Its not real biggy, just one of the features of Prestashop that I really liked over my current evil Actinic is the 'dont direct to a cart summary' to add a product (AJAX) cart.

This would be great!

Share this post


Link to post
Share on other sites
This is a great module, although is there a future with it working with the AJAX cart?


The only reason I didn't do that is that it would involve several more core file changes, and I wanted to reduce the number of required changes. My hope (see signature) is that PrestaShop will build the scaffolding in for people like me to write modules like this *without* needing core file changes. Please vote for my feature request to encourage them to do so.

Share this post


Link to post
Share on other sites
Hi thanks for this, I have noticed that this is only compatible with 1.2, is there anyway that you can make this comaptible to 1.1 as we cannot currently upgrade due to custom database changes.


You need to figure out how to apply these customizations to the latest version and have an upgrade strategy for your store. If you stay at an older version, you will miss important fixes.

For the time being, I will be actively supporting the latest version of PrestaShop only. There may come a time when it's feasable to support multiple releases, but that's probably a long ways off.

Share this post


Link to post
Share on other sites

The only reason I didn't do that is that it would involve several more core file changes, and I wanted to reduce the number of required changes. My hope (see signature) is that PrestaShop will build the scaffolding in for people like me to write modules like this *without* needing core file changes. Please vote for my feature request to encourage them to do so.


Ah ok, understood - thanks for confirming.

I've already signed the feature request thing =)

All the best

Dan

Share this post


Link to post
Share on other sites

is there any way to use this module (the $ discount) with tax included ? using some calculations there are always some differences in cents.

there is also some Zen Cart Modules like Better Together Promotional Page (http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=1396).

Any plans to make them also for prestashop ?

Or better yet the extensions for oscommerce in here http://www.thatsoftwareguy.com/oscommerce.html ?

Share this post


Link to post
Share on other sites
is there any way to use this module (the $ discount) with tax included ? using some calculations there are always some differences in cents.


Are the differences rounding errors or is the tax not being taken into account. I am using the cart's tax settings.


there is also some Zen Cart Modules like Better Together Promotional Page (http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=1396).

Any plans to make them also for prestashop ?

Or better yet the extensions for oscommerce in here http://www.thatsoftwareguy.com/oscommerce.html ?


LOL!! One thing at a time. What I need first is to get the discounting framework into PrestaShop so we don't have to modify core files to do this sort of thing. Please vote for my feature request!

Share this post


Link to post
Share on other sites

i already voted. :-)
I have to say that this module is excelent. Congratulations.

The problem is that the discount that i make is on the final price with tax. For example i have a product that cost 18€. The final price will be 2.95€. So the discount is 15.05€ with tax. but the amout i had to put in the module is 12.54166667. This is the result that i need to have there so that with a 20% tax the final amount is 15.05€ with tax.

$this->add_prod_to_prod(171,1639,"$", 12.5416666667);
$this->add_prod_to_prod(46,47,"$", 14.2083333333);
$this->add_prod_to_prod(29,32,"$", 16.7083333333);
$this->add_prod_to_prod(141,142,"$", 11.7083333333);
$this->add_prod_to_prod(156,158,"$", 18.3750000000);
$this->add_prod_to_prod(59,58,"$", 8.3750000000);
$this->add_prod_to_prod(26,27,"$", 16.7083333333);
$this->add_prod_to_prod(105,101,"$", 12.5416666667);
$this->add_prod_to_prod(1643,1564,"$", 9.2083333333);
$this->add_prod_to_prod(95,96,"$", 16.7083333333);
$this->add_prod_to_prod(133,130,"$", 6.7083333333);
$this->add_prod_to_prod(11,12,"$", 5.8750000000);

for example. And because these are infinite number, multiplying then will not give the same result and the initial amount of reduction. In some cases there is an error of 1 or 2 cent. Its not the amount in question, but sound weird to the costumer to have a reduction of 15,06 or something like that.

It would be nice in the PHP to have an option to select with or without tax the reduction that is put on the module.

maybe you could address this issue later on ;)

Share this post


Link to post
Share on other sites

Just had a thought.
Bare with me... i know nothing of php language or programming :)

$this->add_prod_to_prod(50(2),60(1),”$”, 10);

Is this possible? If buying 2 items of id50, get 10$ of id60

$this->add_prod_to_prod(50(3),60(1),”%”, 100);

If buying 3 items of id50, get one id60 for free

$this->add_prod_to_prod(50(2),50(1),”%”, 100);

Take 2 id50 get 1 for free

And so on...

I think this would take care of almost every type of discount we could imagine along with the already existing in your module.

Share this post


Link to post
Share on other sites

No, Better Together is just "Buy A get B at a discount." If we can get a discounting framework built into PrestaShop, I will add what you're describing later.

Share this post


Link to post
Share on other sites
  • 3 weeks later...

Hi is this compatabile with 1.2.5? Also Im uinsure but does this actually give me a % reduction on the total amount of the cart eg 10% if cart order greather than 1000, 15% if greater then 1500 etc. Thanks

Share this post


Link to post
Share on other sites

A GUI would be nice ;-)
Great stuff, but I miss as a customer seeing what other items I will get a discount on. If it is to boost the sales, it must be clear before they choose a product that they will get it for eg 50%...
Or did I miss something?

/Mats

Share this post


Link to post
Share on other sites

I have to agree with mohsart. That is the one short coming I see. Granted I have not installed it yet but if it could be set up to adjust the price without having to add a product to the cart that would be great. I mainly want to use it to discount accessories and display the discounted accessories on the product page.

Share this post


Link to post
Share on other sites
  • 1 month later...

Hi SWGuy,

Got the module installed again, working great... (Managed to completely break my site by not having the correct permissions though!)

I was just wondering if you have a 'list' of the changes made to the global.css file?

I have made a LOT of changes to mine for the site so cant replace it with the Better Together version

Thanks

Dan

Share this post


Link to post
Share on other sites

Ooh, also forgot to mention that my blockcart module seems to have lost its ability to remove an item from the cart using the little bin icon.

No 'token' variable is being passed in the URL so an invalid token error is happening...

Any thoughts?

Dan

Share this post


Link to post
Share on other sites
Hi SWGuy,

Got the module installed again, working great... (Managed to completely break my site by not having the correct permissions though!)

I was just wondering if you have a 'list' of the changes made to the global.css file?

I have made a LOT of changes to mine for the site so cant replace it with the Better Together version

Thanks

Dan


I didnt bother uploading the new global.css file and just used my file and havent had any problems

Share this post


Link to post
Share on other sites

This is completely OFF TRACK from this TOPIC but highly needed..

Is it possible to use this module or modification to add OPTIONAL postage INSURANCE fee?

Because when you offer free postage, all CARRIERS becomes free and it's not good, because premium carriers needs to be charged at additional rate.

I hope am not the only one thinking the shipping options we have with PS is not sufficient.

Share this post


Link to post
Share on other sites

Hi SW Guy,

Just had our first order on a new site using Better Together and all is good.

One thing though, the discount item doesn't get carried through to the standard Paypal module (NOT API) so no discount is applied.

Luckily we had alternative payment methods set up so the order was able to be completed.

How can i fix this?

(Also any idea on the global.css changes)

Thanks

Dan

Share this post


Link to post
Share on other sites
  • 3 weeks later...

Yes, you are correct - the discount is not deducted from Paypal.

I'm hoping the Presta guys will build in a general discounting framework so I don't have to modify core files and figure this out file by file.

Share this post


Link to post
Share on other sites


I was just wondering if you have a 'list' of the changes made to the global.css file?



If you have already made changes to global.css, the only change you need for Better Together is to style id cart_block_bt in the same way as cart_block_total. So you will want something like this:

#cart_block_bt, #cart_block_wrapping_cost, #cart_block_shipping_cost , #cart_block_total{ padding-right:1.3em; }

Share this post


Link to post
Share on other sites

Is it possible to use this module or modification to add OPTIONAL postage INSURANCE fee?


No. Better Together is "Buy A get B at a discount." That's all.

You should open a new thread to ask your question. By the way, adding an optional fee is exactly the sort of thing my feature request for arbitrary fee/discount logic is intended to facilitate.

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

Scott

Share this post


Link to post
Share on other sites
  • 1 month later...
Hi SW Guy,

Just had our first order on a new site using Better Together and all is good.

One thing though, the discount item doesn't get carried through to the standard Paypal module (NOT API) so no discount is applied.

Luckily we had alternative payment methods set up so the order was able to be completed.

How can i fix this?



Was any fix posted for this?

Share this post


Link to post
Share on other sites
  • 3 weeks later...

Hello,

I've been checking this module and it looks very promising though I wonder if there's some more small features to add.
I've seen there;s a two for one feature on this module, but I wonder if it's possible to do a three for two and other amounts, so you could pick the amount you wish.
Choosing which product to apply the discount can be nice too. For example, if you were to pick two to three different products with different prices, it would automatically give discount to the cheapest product that was chosen (so the cheapest one would be free in a two for one discount)

Good luck on the module and thank you for the time you've spent to make it possible

Share this post


Link to post
Share on other sites
  • 3 weeks later...

This is a great module thanks

I have one issue with it when I trying checking out with PayPal the discount is not sent as part of the PayPal transaction.

the customer ends up paying for the full amount , the discount is not reflected.

I am using PrestaShop 1.2.5 is there a fix for this issue to correct the payment using this modules discount?

Any ideas? thanks

Share this post


Link to post
Share on other sites

I added the following changes for the discount issue, this may help

this fix worked with the better together discounts and the standard discounts

payment.php
add 'better_together' => abs($cart->getOrderTotal(true, 999)),

$smarty->assign(array(
 'address' => $address,
 'country' => new Country(intval($address->id_country)),
 'customer' => $customer,
 'business' => $business,
 'currency' => $currency,
 'paypalUrl' => $paypal->getPaypalUrl(),
 'amount' => number_format(Tools::convertPrice($cart->getOrderTotal(true, 4), $currency), 2, '.', ''),
 'shipping' =>  number_format(Tools::convertPrice($cart->getOrderShippingCost(), $currency), 2, '.', ''),
 'discounts' => $cart->getDiscounts(),
 'better_together' => abs($cart->getOrderTotal(true, 999)),
 'products' => $products,
 'total' => number_format(Tools::convertPrice($cart->getOrderTotal(true, 3), $currency), 2, '.', ''),
 'id_cart' => intval($cart->id),
 'goBackUrl' => (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://').htmlspecialchars($_SERVER  ['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__.'order-confirmation.php?id_cart='.intval($cart->id).'&id;_module='.intval($paypal->id).'&id;_order='.$paypal->currentOrder.'&key;='.$order->secure_key,
   'returnUrl' => (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://').htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__.'modules/paypal/validation.php'
));


paypal.tpl

added
<input type="hidden" name="discount_amount_cart" value="{$better_together}" />

    <input type="hidden" name="email" value="{$customer->email}" />

   <input type="hidden" name="discount_amount_cart" value="{$better_together}" />
{if !$discounts}

Share this post


Link to post
Share on other sites

I am actually using another version of PayPal , not the the standard from PrestaShop,

but the changes in payment.tpl those changes should be placed in paypal.tpl for thePresta Shop supplied version

Share this post


Link to post
Share on other sites

Sorry for the confusion, it was confusion on my side :

paypal.php

   'discounts' => $params['cart']->getDiscounts(),
    'better_together' => abs($cart->getOrderTotal(true, 999)),



paypal.tpl

   <input type="hidden" name="email" value="{$customer->email}" />

   <input type=“hidden” name=“discount_amount_cart” value=”{$better_together}” />

{if !$discounts}



attached is a screen shot of the change in PayPal from my Presta Shop

20389_qKM5655p03xGvXdncLER_t

Share this post


Link to post
Share on other sites

Hi Merlin,

Thanks for confirming that although it does not seem to work with me.

It just shows a blank white page after clicking the courier selection (browser shows order.php in the address bar)

What is the difference in the paypal you are using from the default prestashop one?

Thanks

Dan

Share this post


Link to post
Share on other sites

OK..I like this concept, but have no clue how to install it and what all this means... All I wan to do is offer a discount when some one buys it in combination with another item. Will this do it easily? From what i read, it has to be done manuallY>

I have presta 1.3

Please advise...and how much is install?

Share this post


Link to post
Share on other sites
  • 2 weeks later...

The idea is not the same at all. Better Together is "Buy A get B at a discount." The link you pointed to was "Discount all of category C." But in the spirit of your question: I would be happy to write more discounting software for Prestashop if Prestashop would build in a framework for adding discounts (see my signature).

Share this post


Link to post
Share on other sites
  • 4 weeks later...

How do I get an ad (image) to the top of a category page saying a la 'buy one from this category, get another for 50%'? I also need it multi-language and only certain categories (the categories that were affected by bettertogether module).

Sorry for the post, found an answer at http://www.prestashop.com/forums/viewthread/41013/P0/general_discussion/solved_how_to_use_different_headers_according_to_subcategory_in_the_product_page

The only question remaining is the different imafe for different languages.

Share this post


Link to post
Share on other sites

The add_cat_to_cat rule doesn't seem to work for me. I have the rule set uo as 'add_cat_to_cat(811, 811, "%", 20);' and I had 2 products from category 811 in the cart but there is no %.

Also, when I was playing around with it I noticed that if the same product is in several categories the discount is not applied, for instance, there is a tshirt category 81 and subcategories for each brand and all the products from subcategories are duplicated in cat 81. So if I add products from cat 81, there will be no discount because the rule is for cat 811, although the same product is in cat 811 as well? Is that correct?

What I want to do is to have a promotion like 'buy any 2 or more armani tshirts and get 10 off EVERYTHING. The items are in several categories, like men, women etc. Is that doable within the module?

Share this post


Link to post
Share on other sites
The add_cat_to_cat rule doesn't seem to work for me. I have the rule set uo as 'add_cat_to_cat(811, 811, "%", 20);' and I had 2 products from category 811 in the cart but there is no %.


Better Together uses the default category field. A product can be in multiple categories in PrestaShop, but only the default category is considered.


Also, when I was playing around with it I noticed that if the same product is in several categories the discount is not applied, for instance, there is a tshirt category 81 and subcategories for each brand and all the products from subcategories are duplicated in cat 81. So if I add products from cat 81, there will be no discount because the rule is for cat 811, although the same product is in cat 811 as well? Is that correct?


Once you "use up" a product in a discount, that product is not considered again. So in your example, if you had 3 items from category 811, only one would be discounted.


What I want to do is to have a promotion like 'buy any 2 or more armani tshirts and get 10 off EVERYTHING. The items are in several categories, like men, women etc. Is that doable within the module?


No. Better Together is just "buy ONE get ONE at a discount"

Share this post


Link to post
Share on other sites

Thank you.

What is the default category? I mean, if the product is in the category 1, 2, and 3, which one of them is the default then?

And does the order of the adding products to the cart matters? If the rule is cat-to-cat (1, 2, %, 50), should I add the product from category 1 first?

Share this post


Link to post
Share on other sites
  • 1 month later...

Is this module compatible with prestashop 1.3 and up? I have all the instructions for installation and configuration, just wanted to know if it would actually work if I implemented it.


Thanks a mil!

Share this post


Link to post
Share on other sites
  • 1 month later...

Sorry, it's probably my English, but what you mean by remerge?

First I tried to copy just the bits of BT from the files which came with the module but it didn't work out so I just copied the files, now it works.

Share this post


Link to post
Share on other sites
  • 2 weeks later...

Hi swguy,

I tried the module and I really like the concept.
However, I noted 3 issues which make the module unusable :

1. The voucher generated by bettertogether is also applied on discounted items ; ideally it would be better to exclude discounted products from the bettertogether field.


2. The bettertogether voucher is applied after calculating of shipping fees ; exemple : if I sell product A for $100.00 and product B $50.00 and make shipping free for $150.00, then the order is with shipping free. Now I give a bettertogether voucher of $10.00 for "Buy A + B", the total order amount is 100 + 50 -10 = 140, but the shipping is still free !?
I know this problem is native with vouchers in PS, but there is a way to solve it by modifying the Classes/Cart.php, for natives vouchers. There is probably a way to solve it for Bettertogether.


3. As already reported in the forum, the Bettertogether voucher is not transmitted to Paypal; this unique issue make the module unusable.

There are certainly people ready to pay a participation for a full functional version of this wonderfull module. Of course, I am. So could you tell me if it's possible to make these changes and for which cost?

Thanks and regards

Share this post


Link to post
Share on other sites

Hello SWGuy,
Any plans to work on updating your module some? At least to have a B/O admin interface? What would help? Would you help implement this on a site for a fee? Would donations help you update the module? I did post to your request/petition to the developers. I really need the ability to have multiple item discounts. Thanks for your work and any help!!

Share this post


Link to post
Share on other sites
  • 1 month later...

Hi I was hoping that some one could point me in the right direction I want to do a 2 for £20 promotion so if you buy 2 items in Cat A it makes them £20 but they are all different selling prices how would I go about doing that?

Hope some one can help

Many thanks

Will

Share this post


Link to post
Share on other sites

First of all very nice module / core change!

Now im on v. 1.2.5 and using the very popular One Page Checkout modul, so overwriting classes and core files will mess with my checkout process. Could you perhaps make a install version / description where i could add the changes to the core files and cart module my self, and ofcourse to others using the OPC aswell?

Then Secoundly i was woundering if this easyly could be changed to give a discount on the total amount. Lets say amout goes above 1000, then it would add a discount of 10%?

Share this post


Link to post
Share on other sites
  • 1 month later...

That's what the module is for.

You have to manually create the rules though for each category. Which could be quite a task if you have a lot of categories as you have to enter the combinations for all the categories.

Share this post


Link to post
Share on other sites
  • 4 weeks later...

I just noticed that in my case the rule

$this->add_cat_to_cat(83, 811, "$", 45);

doesn't count different currencies. I have multi currency shop. The amount 45 is in euros, when I switch to Swedish krona it will still be 45 kr although the 9-times difference in currency rates.

Is there something we can do about it?

Share this post


Link to post
Share on other sites
  • 3 weeks later...

Best swguy!

Any chance of you doing a better together/discount-module for 1.4, using the new feature “Overriding PrestaShop Core” in 1.4? Myself and I think many other would happily pay for an easy install module of this kind.

Share this post


Link to post
Share on other sites
  • 2 months later...
  • 3 months later...
  • 3 weeks later...

I would love to see this for 1.4 also, but my programmer won't let me use anything that changes the CORE because of future upgrade problems. Is there a way to make this work in 1.4 that doesn't hack the core? It would be wonderful!

Share this post


Link to post
Share on other sites
  • 3 months later...

Hello all :)

I`m new here... I`ve been thinking about this module for a long time... the problem is that I don`t know if I can use it in this way...

if the customer buys one product A and 4 products B, then he will get 4% off poduct A and 10 % off every product B... if the customers buys one product A and one product B nothing will happen - is it possible to do it with thi module?

how can I do it?

Best, :)

Share this post


Link to post
Share on other sites
  • 7 months later...

Maybe this isn't being developed any more but -

Would like to see a new version for 1.4+

Would like to see the syntax for other options & variables added such as buy 3 get 1 free etc

 

This is an interesting module & PS should definitely implement this type of discounting module as vouchers are very limited in flexibility as well as generating problems with few fail-safes for such as multiple re-applications in a single cart.

  • Like 1

Share this post


Link to post
Share on other sites
  • 3 years later...
  • 1 year later...
  • 1 year 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...

Important Information

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