TOPIC:

Resource booking based on user subscription. 2 months 2 weeks ago #244581

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10063
  • Karma: 167
  • Thanks: 799
tbh, not done yet, the setup for this was a little complex and yesterday was quite busy. But I will continue today.

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

Resource booking based on user subscription. 2 months 2 weeks ago #244627

  • Topic Author
  • snappysites
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 39
  • Thanks: 0
Thank you

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

Resource booking based on user subscription. 2 months 1 week ago #244751

  • Topic Author
  • snappysites
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 39
  • Thanks: 0
Hi, Markus.
Any further progress?

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

Resource booking based on user subscription. 2 months 1 week ago #244801

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10063
  • Karma: 167
  • Thanks: 799
Hi,

I've had mixed results yesterday that weren't really satisfying to me.
Give a me a another couple of hours, please.

Regards,
Markus

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

Resource booking based on user subscription. 2 months 1 week ago #244829

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10063
  • Karma: 167
  • Thanks: 799
Ok, I think I found a good way.

After the form has been added to the product in the admin.
Add this in form => advanced => more options:

Form Pieces => Before Form => Custom:
if( JRequest::getInt('product_id', 0) > 0 ){

    JFactory::getSession()->set('last_product_id', JRequest::getInt('product_id', 0));
}

This will store the last known product id from within the form has been displayed.

Then in Submit Pieces => End Submit => Custom add this:
$pid = JFactory::getSession()->get('last_product_id', 0);

if( $pid ){

    $add_pid = 0;

    switch( $pid ){

        case 1732: $add_pid = 1733; break;
        case 1731: $add_pid = 1734; break;
        // and so on
    }

    if( $add_pid ){

        JRequest::setVar('format',  'json');
        JRequest::setVar('product_id',  $add_pid , 'post');
        JRequest::setVar('amount',  1, 'post');

        JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_breezingcommerce/models', 'BreezingcommerceModel');

        $cart = JModelLegacy::getInstance('cart', 'BreezingcommerceModel');

        $cart->add();

    }
}

Here it picks the last known product id and depending on what product has been displayed, it will select another product in the switch cases.

The selected product from the switch will then be added to cart.

In the end, you will have 2 products in the cart with a single add to cart click.

[EDIT] I would also suggest to add a simple filter on the $pid itself to make sure only selected product ids can have additional products being added to the cart.
$pid = JFactory::getSession()->get('last_product_id', 0);

if(!in_array($pid, array(123,321,456,654))) return;

// and so on...

Regards,
Markus

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

Last edit: Post by TheMuffinMan.

Resource booking based on user subscription. 2 months 1 week ago #245085

  • Topic Author
  • snappysites
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 39
  • Thanks: 0
Hi, Markus

Thanks for your help so far.

I'm not sure I understand, though, how your suggested solution will do the following:
  1. detect that the user has a valid, current, membership;
  2. limits the number of available (bookable) yoga classes based on the length of membership; and
  3. resets availability when the user renews membership

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

Time to create page: 0.050 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

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!