Coupon code valid only if custom field enabled

  • Antonio Grazioli
  • Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 1 month ago #42435 by Antonio Grazioli
Coupon code valid only if custom field enabled was created by Antonio Grazioli
Hi, we are using Events Booking on our website, www.pipeline.it
we organize and sell Microsoft Courses.

like this:
www.pipeline.it/it/173-moc-10775-adminis...ses/view_schedacorso

I already have customized some parts of event booking to generete a course catalog and so on.

We would now like to offer a discount to customers if they bring their own laptop to follow the course.
I have created a custom checkbox field in the course if this option is avalialbe.

Then I would like to create a disocunt coupon for all courses; this has to be valid for ALL courses but ONLY if this custom option is enabled...

I'm not afraid of editing a bit of code, just direct me where/which files I need to modify :-)

thanks :-)


Is iot possible to do it?

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

  • Antonio Grazioli
  • Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 1 month ago #42454 by Antonio Grazioli
Replied by Antonio Grazioli on topic Coupon code valid only if custom field enabled
SOLVED

I added a custom field of type "checkbox" , then I edited the controller file at around line 415:


if ($rowCoupon) {
if ($rowCoupon->code =="MyCoupon")
{
$sql = 'SELECT custom_fields FROM #__eb_events WHERE id='.$eventId;
$db->setQuery($sql) ;
$rowEvent = $db->loadObject();
if (strpos($rowEvent->custom_fields, "MyCustomFieldString")>0)
{
$_SESSION = $rowCoupon->id ;
}
else
{$errorCoupon = true ;}
}
else
{
$_SESSION = $rowCoupon->id ;
}
}
else {
$errorCoupon = true ;
}
} else {
unset($_SESSION) ;
}

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

Moderators: Tuan Pham Ngoc