WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Bakery Shop »
  • 25% off Bakery prices if user is logged on
  • Print
Pages: [1]   Go Down

Author Topic: 25% off Bakery prices if user is logged on  (Read 10378 times)

Offline svsanchez

  • Posts: 589
25% off Bakery prices if user is logged on
« on: February 11, 2014, 05:45:34 PM »
Hello community

I have a customer who wants to sell products both to regular visitors as to "members" of his shop, who act as resellers. He has asked me if it would be possible to show a 25% off price to customers who sign-in to his bakery cart.

So, not logged customer would see $100
But a logged customer would see $75 instead

Given the flexibility of Bakery, I guess this shouldn't be too difficult to do? What do you think?
Logged

Offline svsanchez

  • Posts: 589
Re: 25% off Bakery prices if user is logged on
« Reply #1 on: February 12, 2014, 10:15:23 PM »
Hmmm... I guess it's not so easily achievable? And what about using a 'discount code' at checkout? Like "enter your member code in order to get your member discount"?
Logged

Offline marmot

  • Posts: 1103
Re: 25% off Bakery prices if user is logged on
« Reply #2 on: February 14, 2014, 03:57:56 PM »
Hi,

Quote from: svsanchez on February 12, 2014, 10:15:23 PM
Hmmm... I guess it's not so easily achievable?
depends on what you consider to be easy. Just find the relevant places where the price is read from the database:
Code: [Select]
\modules\bakery\view.php(273):    
$sql_result2 = $database->query("SELECT title, price, sku, stock, tax_rate FROM " .TABLE_PREFIX."mod_bakery_items WHERE item_id = '$item_id'");
----------------------------------------
\modules\bakery\view_item.php(100):
$query_item = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_bakery_items WHERE item_id = '".ITEM_ID."' AND active = '1'");
----------------------------------------
\modules\bakery\view_overview.php(69):
$query_items = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_bakery_items WHERE section_id = '$section_id' AND active = '1' AND title != '' ORDER BY position ASC".$limit_sql);
and combine them with detection of user Group (patch "Administrator" group to your needs):
Code: [Select]
\modules\bakery\view.php(273):
$sel = $sel = isset($_SESSION['GROUP_NAME']) && in_array('Administrators', $_SESSION['GROUP_NAME']) ? "item_id, section_id, page_id, group_id, active, position, title, sku, stock, (price * 0.75) AS price, shipping, tax_rate, definable_field_0, definable_field_1, definable_field_2, link, description, full_desc, modified_when, modified_by, created_when, created_by" : "*";
$sql_result2 = $database->query("SELECT ".$sel." FROM " .TABLE_PREFIX."mod_bakery_items WHERE item_id = '$item_id'");
----------------------------------------
\modules\bakery\view_item.php(100):
$sel = $sel = isset($_SESSION['GROUP_NAME']) && in_array('Administrators', $_SESSION['GROUP_NAME']) ? "item_id, section_id, page_id, group_id, active, position, title, sku, stock, (price * 0.75) AS price, shipping, tax_rate, definable_field_0, definable_field_1, definable_field_2, link, description, full_desc, modified_when, modified_by, created_when, created_by" : "*";
$query_item = $database->query("SELECT ".$sel." FROM ".TABLE_PREFIX."mod_bakery_items WHERE item_id = '".ITEM_ID."' AND active = '1'");
----------------------------------------
\modules\bakery\view_overview.php(69):
$sel = $sel = isset($_SESSION['GROUP_NAME']) && in_array('Administrators', $_SESSION['GROUP_NAME']) ? "item_id, section_id, page_id, group_id, active, position, title, sku, stock, (price * 0.75) AS price, shipping, tax_rate, definable_field_0, definable_field_1, definable_field_2, link, description, full_desc, modified_when, modified_by, created_when, created_by" : "*";
please backup and test before using this.

regards

Edith: added test for session field GROUP_NAME to avoid warnings and notices
« Last Edit: February 25, 2014, 10:38:34 PM by marmot »
Logged

jacobi22

  • Guest
Re: 25% off Bakery prices if user is logged on
« Reply #3 on: February 14, 2014, 04:44:48 PM »
if i remember correct, svsanchez  use the bakery 1.60,  if so, take a look to the code lines before you change anything

the code from marmot (bakery 1.70) is the same in bakery 1.60, but the code lines are different

\modules\bakery\view.php(273)  in Vers. 1.70 is line 250 in Vers 1.60
\modules\bakery\view_item.php(100) in Vers. 1.70 is line 78 in Vers 1.60
\modules\bakery\view_overview.php(69) in Vers. 1.70 is line 85 in Vers 1.60

in the german bakery thread we have some solutions for a new price, if you use a item options, based on javascript or jquery. can that be a way?
Logged

Offline svsanchez

  • Posts: 589
Re: 25% off Bakery prices if user is logged on
« Reply #4 on: February 14, 2014, 11:41:01 PM »
Hello Marmot and Jacobi for your help. Yes I use version bakery 1.6!

Jacobi, any way I could achieve having the 2 prices depending on the 'usergroup' as Marmot suggested is worth looking at. Can you point me to the german forum as I wouldn't know how to search for it in German (I don't speak the language) so I can try translating it with google translate!

Thanks again!
Logged

jacobi22

  • Guest
Re: 25% off Bakery prices if user is logged on
« Reply #5 on: February 15, 2014, 02:30:06 PM »
Quote
Can you point me to the german forum as I wouldn't know how to search for it in German (I don't speak the language) so I can try translating it with google translate!

http://www.WebsiteBaker.org/forum/index.php/topic,24695.0.html
Logged

Lighat

  • Guest
Re: 25% off Bakery prices if user is logged on
« Reply #6 on: February 25, 2014, 11:02:38 AM »
How can i get this discount?
Logged

jacobi22

  • Guest
Re: 25% off Bakery prices if user is logged on
« Reply #7 on: February 25, 2014, 03:30:26 PM »
see the post from marmot in the top of the thread here, it works without problems
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Bakery Shop »
  • 25% off Bakery prices if user is logged on
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2