Coupon accept message

08.12.2023 17:58
#1
heinzm
Joomshopping forum user no avatar
Name: heinz
11.02.2012
Сообщения: 84
Quote
Coupon accept message

How is it be able to show a message for customer, that the discount code has been accepted.
The error messages like “Incorrect code” or “Coupon not valid” and so on are displayed.
I'm using Template Gray 2.6.0.


Joomla: 4.4.1
JoomShopping: 5.2.2
Website Url: juwelen-binder.at
 
08.12.2023 22:10
#2
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Сообщения: 25942
Quote
Aw: Coupon accept message

Not problem in Template.

See http://demo.joomshopping.com
code: 1000

There's no message.

Will be in new version JoomShopping

 
09.12.2023 12:44
#3
heinzm
Joomshopping forum user no avatar
Name: heinz
11.02.2012
Сообщения: 84
Quote
Aw: Coupon accept message

Ok, I understand. Thanks for support.

Another question:
Is it also possible to display the "discount code" field in all steps of the order, or at least before submitting the order?

 
09.12.2023 14:26
#4
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Сообщения: 25942
Quote
Aw: Coupon accept message

https://www.webdesigner-profi.de/joomla-webdesign/shop/addons/display-coupon-code.html?lang=en

 
09.12.2023 15:42
#5
heinzm
Joomshopping forum user no avatar
Name: heinz
11.02.2012
Сообщения: 84
Quote
Aw: Coupon accept message

Yes, I know/I have installed this plugin, which I have been using for a long time.
But what I meant is whether you can make the field for entering the discount code visible at all steps of the order (below or in the shopping cart), and not just on the entry page. In case, someone forgets to enter the code on the first step.

 
09.12.2023 16:04
#6
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Сообщения: 25942
Quote
Aw: Coupon accept message

Add in tempate
components\com_jshopping\templates\default\cart\checkout.php

code

<div class="cart_block_discount">
<form name="rabatt" method="post" action="<?php print \JSHelper::SEFLink('index.php?option=com_jshopping&controller=cart&task=discountsave'); ?>">
<div class="jshop">
<div class="span12">
<div class="name"><?php print JText::_('JSHOP_RABATT')?></div>
<input type="text" class="inputbox" name="rabatt" value="" />
<input type="submit" class="button btn btn-primary" value="<?php print JText::_('JSHOP_RABATT_ACTIVE')?>" />
</div>
</div>
</form>
</div>

after (row 221)
<?php print $this->_tmp_html_after_checkout_cart?>

----------------------------------------------------------------------------------

For template Gray
components\com_jshopping\templates\\joomshopping_flex\cart\checkout.php

after row 183

add code:

<div class="cart_block_discount">
<form class="d-flex" name="rabatt" method="post" action="<?php print \JSHelper::SEFLink('index.php?option=com_jshopping&controller=cart&task=discountsave'); ?>">
<input type="text" class="inputbox" name="rabatt" value="" id="rabat" placeholder="<?php print \JText::_('JSHOP_RABATT') ?>" />
<input type="submit" class="btn normaltext button" value="<?php print \JText::_('JSHOP_RABATT_ACTIVE') ?>" />
</form>
</div>


Последнее изменение: 09.12.2023 16:10
 
10.12.2023 10:30
#7
heinzm
Joomshopping forum user no avatar
Name: heinz
11.02.2012
Сообщения: 84
Quote
Aw: Coupon accept message

Thank you for the information.
It works - almost - perfectly.
Unfortunately, when you enter the code at the "Address", "Payment" or "Delivery method" level, the page always jumps back to the "Shopping cart page" and you have to click through all the steps again.

Is there a way to change that?


Последнее изменение: 14.12.2023 13:59
 
14.12.2023 20:19
#8
heinzm
Joomshopping forum user no avatar
Name: heinz
11.02.2012
Сообщения: 84
Quote
Aw: Coupon accept message

Is there an answer to my question?

 
14.12.2023 21:01
#9
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Сообщения: 25942
Quote
Aw: Coupon accept message

Will be in new version JoomShopping

 
16.12.2023 11:36
#10
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Сообщения: 25942
Quote
Aw: Coupon accept message

1. change code to:

<div class="cart_block_discount">
<form class="d-flex" name="rabatt" method="post" action="<?php print \JSHelper::SEFLink('index.php?option=com_jshopping&controller=cart&task=discountsave'); ?>">
<input type="text" class="inputbox" name="rabatt" value="" id="rabat" placeholder="<?php print \JText::_('JSHOP_RABATT') ?>" />
<input type="submit" class="btn normaltext button" value="<?php print \JText::_('JSHOP_RABATT_ACTIVE') ?>" />
<input type="hidden" name="back_step" value="<?php print $this->step?>">
</form>
</div>

2. will be in JoomShopping 5.3.0

components\com_jshopping\Controller\CartController.php

chnge function discountsave(){
...............
}

to:

function discountsave(){
$dispatcher = \JFactory::getApplication();
$dispatcher->triggerEvent('onLoadDiscountSave', array());

$ajax = $this->input->getInt('ajax');
$code = $this->input->getVar('rabatt');
$back_step = $this->input->getInt('back_step');

$coupon = \JSFactory::getTable('coupon');
$cart = \JSFactory::getModel('cart', 'Site');

if ($coupon->getEnableCode($code)){
$cart->load();
$dispatcher->triggerEvent('onBeforeDiscountSave', array(&$coupon, &$cart));
$cart->setRabatt($coupon->coupon_id, $coupon->coupon_type, $coupon->coupon_value);
$dispatcher->triggerEvent('onAfterDiscountSave', array(&$coupon, &$cart));
if ($ajax){
print \JSHelper::getOkMessageJson($cart);
die();
}
\JSError::raiseMessage('', \JText::_('JSHOP_RABATT_APPLIED'));
}else{
\JSError::raiseWarning('', $coupon->error);
if ($ajax){
print \JSHelper::getMessageJson();
die();
}
}

if ($back_step) {
$url = \JSFactory::getModel('checkoutStep', 'Site')->getCheckoutUrl((string)$back_step, 1);
} else {
$url = \JSHelper::SEFLink($cart->getUrlList(), 0, 1);
}
$this->setRedirect($url);
}

 
19.12.2023 12:08
#11
heinzm
Joomshopping forum user no avatar
Name: heinz
11.02.2012
Сообщения: 84
Quote
Aw: Coupon accept message

Perfect, it works, but only the accept message is not correct: "JSHOP_RABATT_APPLIED".

Kind regards!
Aw: Coupon accept message

 
19.12.2023 12:13
#12
heinzm
Joomshopping forum user no avatar
Name: heinz
11.02.2012
Сообщения: 84
Quote
Aw: Coupon accept message

I have changed the code in the CartController.php by myself to "Rabattcode akzeptiert".

Many thanks for your perfect service!!

 


Copyrights MAXXmarketing GmbH. Alle Rechte vorbehalten
Durch die Nutzung dieser Website stimme ich zu, dass Cookies zur optimalen Gestaltung der Website sowie zur Analyse der Nutzung der Website verwendet werden. Weiterführende Informationen finden Sie hier. OK, einverstanden.