1. Go to this page and download the library: Download remp/crm-salesfunnel-module library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
remp / crm-salesfunnel-module example snippets
namespace Crm\ExampleModule\Events;
use Crm\PaymentsModule\PaymentItem\DonationPaymentItem;
use League\Event\AbstractListener;
use League\Event\EventInterface;
class PaymentItemContainerReadyEventHandler extends AbstractListener
{
public function handle(EventInterface $event)
{
$paymentData = $event->getPaymentData();
if (isset($paymentData['specific_donation']))
{
$paymentItemContainer = $event->getPaymentItemContainer();
$paymentItemContainer->addItem(
new DonationPaymentItem(
$name = 'Specific donation',
$price = $paymentData['specific_donation'],
$vat = 0
)
);
}
}
}
public function registerEventHandlers(\League\Event\Emitter $emitter)
{
//...
$emitter->addListener(
\Crm\SalesFunnelModule\Events\PaymentItemContainerReadyEvent::class,
$this->getInstance(\Crm\ExampleModule\Events\PaymentItemContainerReadyEventHandler::class)
);
//...
final class SalesFunnelTwigVariablesDataProvider implements SalesFunnelVariablesDataProviderInterface
{
// add ability to load snippets, check docblock for further info
use SalesFunnelTwigSnippetLoaderTrait;
public function provide(array $params): array
{
if (!isset($params[self::PARAM_SALES_FUNNEL])) {
throw new DataProviderException('missing [' . self::PARAM_SALES_FUNNEL . '] within data provider params');
}
$salesFunnel = $params[self::PARAM_SALES_FUNNEL];
$returnParams = [];
// adding custom twig variable
$returnParams['your_custom_twig_variable'] = 'your_custom_twig_variable';
// load snippets (feature provided by ApplicationModule)
$snippetsToLoad = ['header', 'footer', 'sales-funnel-common-header'];
$returnParams += $this->loadSnippets($salesFunnel, $loadSnippets);
return $returnParams;
}
}
use Crm\SalesFunnelModule\DI\Config;
use Crm\SalesFunnelModule\Models\SalesFunnelsCache;
class DemoModule extends CrmModule
{
// ...
public function registerRoutes(RouteList $router)
{
// to avoid iframes for all sales funnels of Demo instance
if ($this->config->getFunnelRoutes()) {
foreach ($this->salesFunnelsCache->all() as $salesFunnel) {
$router->prepend(new Route(
"<funnel {$salesFunnel->url_key}>",
'SalesFunnel:SalesFunnelFrontend:show'
));
}
}
}
// ...
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.