-- HikaShop version -- : 2.3.2
-- HikaMarket version -- : 1.4.3
-- Joomla version -- : 3.3
Hi Jerome,
We need to speed up the vendors' frontend confirmation process a bit.
I created a button and connected a function for it in /components/com_hikamarket/controllers/order.php
function jovahagyott_order(){
$app = JFactory::getApplication();
$db = JFactory::getDBO();
$order_id = JRequest::getVar('order_id');
$order_number = JRequest::getVar('order_number');
$query = 'UPDATE '.hikashop_table('order').' SET order_status="confirmed" WHERE order_number='.$db->Quote($order_number);
$db->setQuery($query);
$result = $db->query();
$redirect_url = JRequest::getVar('redirect_url');
$app->redirect($redirect_url);
return true;
}
}
The buttons in the listing view template are injected in this way:
<?php if($order->order_status == 'created') {?>
<form id="adminForm_<?php echo $order->order_id; ?>_jovahagyott" action="<?php echo hikashop_currentURL(); ?>" method="post" name="adminForm_<?php echo $order->order_id; ?>_jovahagyott">
<button type="submit" class="btn btn-large right" name="jovahagyott_order" value="OK" onclick="var field=document.getElementById('<?php echo $order->order_id; ?>');document.adminForm_<?php echo $order->order_id; ?>_jovahagyott.submit();return false;">OK</button>
<input type="hidden" name="Itemid" value="<?php echo $Itemid; ?>"/>
<input type="hidden" name="option" value="<?php echo HIKAMARKET_COMPONENT; ?>" />
<input type="hidden" name="task" value="jovahagyott_order" />
<input type="hidden" name="order_number" value="<?php echo $order->order_number ?>" />
<input type="hidden" name="email" value="1" />
<input type="hidden" name="order_id" value="<?php echo $order->order_id; ?>" />
<input type="hidden" name="ctrl" value="<?php echo JRequest::getCmd('ctrl'); ?>" />
<input type="hidden" name="redirect_url" value="<?php echo hikashop_currentURL(); ?>" />
<?php echo JHTML::_( 'form.token' ); ?>
</form>
<?php }?>
It works as we need, the only missing point is to solve somehow to send the order status change notification emails (both to user and vendor) the same way as it sends if we use the frontend status editing in the default way (click on order details, click on edit order status part, click on dropdown to choose status, then click save).
Could you give me a small code hint how should I solve that?