TOPIC:

What are the PHP code limitations for price? 3 years 5 months ago #188653

  • lovre's Avatar
  • lovre
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 2667
  • Karma: 76
  • Thanks: 329
Hi,

you should put regular php there, that calculates and sets the $price variable.

For example set a price depending on a user group as you mentioned:
$user = JFactory::getUser();
$groups = $user->get('groups');
foreach($groups as $group)
{ 
if ($group=='8') {$price='199';}
elseif ($group=='9') {$price='0';}
else {$price='10000';}
}
but be careful, users can be in more than one group.

You could tell us in a little bit few more words what exactly are you trying to accomplish so we can help you with more precise instructions/code.

Please let us know if this answers your question.
Support Crosstec and get ALL EXTENSIONS and professional support for just $5
Here!
===========================================
Need to renew Pro Support?
Buy Here!
===========================================
Satisfied?
Consider a membership!
===========================================
Like us on Facebook
===========================================

Please Log in or Create an account to join the conversation.

Last edit: Post by lovre.

What are the PHP code limitations for price? 3 years 5 months ago #188712

  • Den
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 108
  • Karma: -1
  • Thanks: 0
Thanks for the quick response!!!)
I need to set fixed prices for different groups of customers on product or different properties by using BreezingForms.

Sorry for my bad English)))

Please Log in or Create an account to join the conversation.

What are the PHP code limitations for price? 3 years 5 months ago #188793

  • Den
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 108
  • Karma: -1
  • Thanks: 0

File Attachment:

File Name: Largeforma...ting.zip
File Size:33 KB



This is best done through BreezingForms or BreezingCommerce???
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: Post by Den.

What are the PHP code limitations for price? 3 years 5 months ago #188875

  • lovre's Avatar
  • lovre
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 2667
  • Karma: 76
  • Thanks: 329
Hello,

Yes, you can do this calculation either:

1. Through the BF element's actionscripts (JavaScript) and then just specify the price in the BC price plugin as the vaule of the TOTAL PRICE PRINT.

2. Completly through the BC price plugin. Your form doesn't need a TOTAL PRICE PRINT field as the $price variable will be calculated here. You would here do the same math as in #1 but in php. You would access an element value like this here:
$myvalue=$fields->SomeFieldName->value;

Bottom line you could do the calculation either way but I would suggest the #1 as it will dynamically show the price that would apply (in the read-only TOTAL PRICE PRINT element). #2 would just show do the calculated price on the checkout.

Let us know if you'll need help with the calculation.

Regards,

Lovre
Support Crosstec and get ALL EXTENSIONS and professional support for just $5
Here!
===========================================
Need to renew Pro Support?
Buy Here!
===========================================
Satisfied?
Consider a membership!
===========================================
Like us on Facebook
===========================================

Please Log in or Create an account to join the conversation.

Last edit: Post by lovre.

What are the PHP code limitations for price? 3 years 5 months ago #188885

  • Den
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 108
  • Karma: -1
  • Thanks: 0
Thank for all you have described! I also thought that 1 option is better.

"Let us know if you'll need help with the calculation."

Show the sample actionscripts please to BF for different users group.
Thank you!!!

Please Log in or Create an account to join the conversation.

What are the PHP code limitations for price? 3 years 5 months ago #188906

  • lovre's Avatar
  • lovre
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 2667
  • Karma: 76
  • Thanks: 329
Hello,

You can achieve this by doing the following:

1. Create a new textfield BF element, call it groupAddition and turn it off.
2. Go to Form> Form Pieces> Before Form> Custom:
$this->execPieceByName('ff_InitLib');
$user = JFactory::getUser();
$groups = $user->get('groups');
foreach($groups as $group)
{ 
if ($group=='1') {ff_setValue('groupAddition', '0'); }
elseif ($group=='2') {ff_setValue('groupAddition', '10'); }
elseif ($group=='3'){ff_setValue('groupAddition', '20');}
}

3. Your radiogroup element should be defined like this:
0;dpi1;80
0;dpi2;130
0;dpi3;180

4. radiogroup should have a "change" actionscript setting the A element like this:
function ff_radiogroupElementName_action(element, action)
{
ff_getElementByName('AElementName').value =Number(jQuery('[name="ff_nm_radiogroupElementName[]"]:checked').val()) + Number(ff_getElementByName('groupAddition').value);
}

Just be sure to change the radiogroupElementName and AElementName values in the code to your BF element names. You can keep the groupAddition value if you have done the step #1 exactly as described above.

Please try this out and let us know if it's working out for you.
Support Crosstec and get ALL EXTENSIONS and professional support for just $5
Here!
===========================================
Need to renew Pro Support?
Buy Here!
===========================================
Satisfied?
Consider a membership!
===========================================
Like us on Facebook
===========================================

Please Log in or Create an account to join the conversation.

Time to create page: 0.056 seconds

Summer Sale!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!