[Xen-Soluce] Upgrade Coupons

[Xen-Soluce] Upgrade Coupons [Paid] 2.1.3 Fix 2

No permission to buy (€15.00)
Why not?
You want to give people a lower price, i want to give (some special people) a free entrance without using the acp.

There are many scenarios for doing this.
 
It is not free, because you need that coupon.

  • give a code for one week to every new user
  • give a code for a month with special ads somewhere else
  • give a code in real life, when you enter a coffeeshop and buy a coffee
  • send it to special users by mail or pm
  • give it to friends to invite others

If you need someone for ideas around addons just write me. :)
I have a huge list with addons nobody has done till now.
 
It is not free, because you need that coupon.

  • give a code for one week to every new user
  • give a code for a month with special ads somewhere else
  • give a code in real life, when you enter a coffeeshop and buy a coffee
  • send it to special users by mail or pm
  • give it to friends to invite others

If you need someone for ideas around addons just write me. :)
I have a huge list with addons nobody has done till now.
But you're using an addon to charge registration, aren't you?
 
Hello,


Sorry for the delay, no it is not possible, why did you have to add 1000 coupons?

Regards, CRUEL-MODZ
If I want to sell them for my users, I will face a problem on large forums, will be long and boring them to add them ...
can you please make upgrade if i pay you for it?
 
Looking through the code of this add-on, it looks pretty solid, but I've found a few places that could use a bit of improvement. None of it is a real deal-breaker, but for big sites, this would have a positive effect on performance.

In Repository\UpgradeCoupons, there is a handful of complicated add-on enabled checks that consume a database query each when they should not. For reference:
PHP:
$addon = \XF::em()
    ->getFinder('XF:AddOn')
    ->where([
        'addon_id' => 'XenSoluce/UserUpgradePro',
        'active' => 1
    ])
    ->fetchOne();
if(empty($addon))
{
    return false;
}
return true;

Should be replaced simply with
PHP:
$cache = \XF::app()->container('addon.cache');
return !empty($cache['XenSoluce/UserUpgradePro']);

In XF\Purchasable\UserUpgrade, around Line 119, the user upgrade is queried when it was previously already queried in Line 109.

In Entity\UpgradeCoupons, the pre-save check launches a DB query to determine whether the coupon code is unique. This can be achieved by using the 'unique' => 'xs_uc_promo_code_must_be_unique' value on the entity column without extra code. Ideally, the database column should also be declared unique.
 
Looking through the code of this add-on, it looks pretty solid, but I've found a few places that could use a bit of improvement. None of it is a real deal-breaker, but for big sites, this would have a positive effect on performance.

In Repository\UpgradeCoupons, there is a handful of complicated add-on enabled checks that consume a database query each when they should not. For reference:
PHP:
$addon = \XF::em()
    ->getFinder('XF:AddOn')
    ->where([
        'addon_id' => 'XenSoluce/UserUpgradePro',
        'active' => 1
    ])
    ->fetchOne();
if(empty($addon))
{
    return false;
}
return true;

Should be replaced simply with
PHP:
$cache = \XF::app()->container('addon.cache');
return !empty($cache['XenSoluce/UserUpgradePro']);

In XF\Purchasable\UserUpgrade, around Line 119, the user upgrade is queried when it was previously already queried in Line 109.

In Entity\UpgradeCoupons, the pre-save check launches a DB query to determine whether the coupon code is unique. This can be achieved by using the 'unique' => 'xs_uc_promo_code_must_be_unique' value on the entity column without extra code. Ideally, the database column should also be declared unique.
Hello, thanks, tagging @CRUEL-MODZ for this! :)

Regards, SyTry
 
Top Bottom