Skip to main content

Using points to pay for purchase

12 years 9 months ago #145982 by simmiepam
-- url of the page with the problem -- : mywebsite.com/mypage
-- HikaShop version -- : 2.3.0
-- Joomla version -- : x.x
-- PHP version -- : x.x.x
-- Browser(s) name and version -- : XXXXX x.x.x
-- Error-message(debug-mod must be tuned on) -- : Error_message

I have the option turned on to allow customers to use points to pay for their purchase

The option, however, defaults to YES....I would like it to default to NO and then let the customer turn it on.
I don't want them to see the points deducted and not realize they don't have to use them.

How can I do that?

Pam

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

12 years 9 months ago #146118 by Jerome
Hi,

There is currently no option to set "no" as default for "use points" but it could be an interesting little improvement of the plugin.
For the moment the best will be to modify the plugin directly in order to change the default value.
In both plugins (hikashoppayment userpoint & hikashop userpoints) you will find the code
Code:
$app->getUserState(HIKASHOP_COMPONENT.'.userpoints_no_virtual_coupon', 0)
that you have to change into
Code:
$app->getUserState(HIKASHOP_COMPONENT.'.userpoints_no_virtual_coupon', 1)
to modify the default value (0 to 1).

It requires some PHP skills to do such modification.

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

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

12 years 9 months ago #146178 by simmiepam
Thank you....I'll try it.

I want to learn, so this will be a challenge!

Thanks
Pam

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

12 years 9 months ago #146183 by simmiepam
OK...in my Control Panel I have found these 2 plugins and am ready to update the .php

My question is...

For the Hikashop user points, which file do I alter?



And for the Hikashopuserpoints, which file do I alter?

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

12 years 9 months ago #146189 by Jerome
Hi,

"userpoints.php" in both folders.
You will find two lines with the part of code I pasted. Please be careful to just replace the code I pasted with the other code block, do not remove more content, do not replace the all line.
You can do a "search & replace" with the exact content if you want..

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

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

12 years 9 months ago #146193 by simmiepam
OK

I have found FIVE (5) lines with the text you gave me in the HIKASHOP

Do I change ALL of them from 0 to 1?

1st one...
$app = JFactory::getApplication();
$currencyClass = hikashop_get('class.currency');
$consume = null;
$discount = '';
$use_coupon = 1 - (int)$app->getUserState(HIKASHOP_COMPONENT.'.userpoints_no_virtual_coupon', 0);

2nd one...
function onAfterCheckoutStep($controllerName, &$go_back, $original_go_back, &$controller) {
if($controllerName == 'plg.shop.userpoints') {
$app = JFactory::getApplication();
$this->_readOptions();
if(empty($this->plugin_options)) {
$app->setUserState(HIKASHOP_COMPONENT.'.userpoints_no_virtual_coupon', 0);
return;
}

if(!empty($this->plugin_options)) {
$no_virtual_coupon = (int)$app->getUserState(HIKASHOP_COMPONENT.'.userpoints_no_virtual_coupon', 0);

$use_coupon_opt = JRequest::getString('userpoints_use_coupon', '');
if($use_coupon_opt !== '') {
$no_coupon = 1 - (int)$use_coupon_opt;
if($no_coupon != $no_virtual_coupon) {
$go_back = true;
$app->setUserState(HIKASHOP_COMPONENT.'.userpoints_no_virtual_coupon', $no_coupon);
}
}
} else {
$app->setUserState(HIKASHOP_COMPONENT.'.userpoints_no_virtual_coupon', 0);


IN THE OTHER FILE.... the one for HikashopPAYMENT > userpoints, I found TWO (2) lines:

Do I change ALL of them from 0 to 1?

The first one...
$app = JFactory::getApplication();
$currencyClass = hikashop_get('class.currency');
$consume = null;
$discount = '';
$use_coupon = 1 - (int)$app->getUserState(HIKASHOP_COMPONENT.'.userpoints_no_virtual_coupon', 0);

The 2nd one...
$app = JFactory::getApplication();
$no_virtual_coupon = (int)$app->getUserState(HIKASHOP_COMPONENT.'.userpoints_no_virtual_coupon', 0);
if(!empty($no_virtual_coupon)) {

$app = JFactory::getApplication();
$no_virtual_coupon = (int)$app->getUserState(HIKASHOP_COMPONENT.'.userpoints_no_virtual_coupon', 0);

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

12 years 9 months ago #146201 by Jerome
Hi,

All " $app->getUserState(HIKASHOP_COMPONENT.'.userpoints_no_virtual_coupon', 0) "

Not " $app->setUserState(HIKASHOP_COMPONENT.'.userpoints_no_virtual_coupon', 0); "
Not " $app->setUserState(HIKASHOP_COMPONENT.'.userpoints_no_virtual_coupon', $no_coupon); "

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

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

12 years 9 months ago #146213 by simmiepam
Yes, yes yes!!!!

That worked

Thank you!

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

Time to create page: 0.074 seconds
Powered by Kunena Forum