- Posts: 61
- Thank you received: 2
Order Name vs. Order Number (Community Plugin)
13 years 4 weeks ago - 13 years 4 weeks ago #121766
by xsbucks
Order Name vs. Order Number (Community Plugin) was created by xsbucks
Hey guys, wondering on the HikaShop JomSocial Plugin, if there is an easy way to change the 'Order Number' table to an 'Order Name'?
It would be a lot more feasable for what i think a lot of shops have. Would look a little nicer in Jomsocial as well.
Thanks
It would be a lot more feasable for what i think a lot of shops have. Would look a little nicer in Jomsocial as well.
Thanks
Last edit: 13 years 4 weeks ago by xsbucks.
Please Log in or Create an account to join the conversation.
13 years 4 weeks ago #121773
by nicolas
Replied by nicolas on topic Order Name vs. Order Number (Community Plugin)
You can edit the file plugins/community/hikashop/hikashop.php and change the code:
<?php echo JText::_('ORDER_NUMBER'); ?>
to the text you want.
<?php echo JText::_('ORDER_NUMBER'); ?>
to the text you want.
Please Log in or Create an account to join the conversation.
13 years 4 weeks ago #121782
by xsbucks
Replied by xsbucks on topic Order Name vs. Order Number (Community Plugin)
Thanks Nicolas for the quick reply, what i was hoping to do was to grab the name of the file from the DB instead of the Order_Number
Please Log in or Create an account to join the conversation.
13 years 4 weeks ago #121827
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic Order Name vs. Order Number (Community Plugin)
Hi,
Of which name are your talking about ?
Regards,
Of which name are your talking about ?
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
13 years 4 weeks ago #121835
by xsbucks
Replied by xsbucks on topic Order Name vs. Order Number (Community Plugin)
From the hikashop_order_product table,
order_product_name
Do i need just an INNER join? .a and .b DB exception in the module for that?
order_product_name
Do i need just an INNER join? .a and .b DB exception in the module for that?
Please Log in or Create an account to join the conversation.
13 years 4 weeks ago #121842
by nicolas
Replied by nicolas on topic Order Name vs. Order Number (Community Plugin)
I don't think that most shop have that since it's not practical and not really nice to display all the products of each order on the order listing. I might be for simple ecommerce extensions which don't handle shopping carts and thus where you can only purchase one product at a time.
If that's the case on your website (all orders have only one product), simply change:
$query = 'FROM '.hikashop_table('order').' AS a WHERE '.implode(' AND ',$filters).$order;
to:
$query = 'FROM '.hikashop_table('order').' AS a LEFT JOIN #__hikashop_order_product AS b ON a.order_id=b.order_id WHERE '.implode(' AND ',$filters).$order;
and then change :
<?php echo $row->order_number; ?>
to:
<?php echo $row->order_product_name; ?>
If that's the case on your website (all orders have only one product), simply change:
$query = 'FROM '.hikashop_table('order').' AS a WHERE '.implode(' AND ',$filters).$order;
to:
$query = 'FROM '.hikashop_table('order').' AS a LEFT JOIN #__hikashop_order_product AS b ON a.order_id=b.order_id WHERE '.implode(' AND ',$filters).$order;
and then change :
<?php echo $row->order_number; ?>
to:
<?php echo $row->order_product_name; ?>
Please Log in or Create an account to join the conversation.
13 years 4 weeks ago #121871
by xsbucks
Replied by xsbucks on topic Order Name vs. Order Number (Community Plugin)
Thanks Nicolas,
I changed the code as you mentioned... It is still not showing...
I can't seem to find where it is missing, but it should be working as mentioned.
<?php
/**
* @copyright Copyright (C) 2010-2011 HIKASHOP SARL - All rights reserved.
* @license www.gnu.org/licenses/gpl-3.0.html GNU/GPL
*/
defined('_JEXEC') or die('Restricted access');
if(!defined('DS'))
define('DS', DIRECTORY_SEPARATOR);
if(!@include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')){
return;
};
if(!class_exists('plgCommunityHikaShop')){
class plgCommunityHikaShop extends CApplications{
var $name = "My Orders";
var $_name = "orders";
function plgCommunityHikaShop(& $subject, $config){
parent::__construct($subject, $config);
}
function onProfileDisplay(){
$my = & JFactory::getUser();
$user =& CFactory::getActiveProfile();
//only you can see your orders
if (empty($my->id) OR empty($user) OR $my->id != $user->id) return;
//load order info
$database =& JFactory::getDBO();
$searchMap = array('a.order_id','a.order_status');
$filters = array('a.order_user_id='.hikashop_loadUser());
$order = ' ORDER BY a.order_created DESC';
$query = 'FROM '.hikashop_table('order').' AS a LEFT JOIN #__hikashop_order_product AS b ON a.order_id=b.order_id WHERE '.implode(' AND ',$filters).$order;
$database->setQuery('SELECT a.* '.$query);
$rows = $database->loadObjectList();
if(empty($rows)){
return;
}
$currencyHelper = hikashop_get('class.currency');
$trans = hikashop_get('helper.translation');
$statuses = $trans->getStatusTrans();
ob_start();
?>
<table class="hikashop_orders adminlist" cellpadding="1">
<thead>
<tr>
<th class="title" align="center">
<?php echo JText::_('ORDER_NUMBER'); ?>
</th>
<th class="title" align="center">
<?php echo JText::_('DATE'); ?>
</th>
<th class="title" align="center">
<?php echo JText::_('ORDER_STATUS'); ?>
</th>
<th class="title" align="center">
<?php echo JText::_('HIKASHOP_TOTAL'); ?>
</th>
</tr>
</thead>
<tbody>
<?php
$k = 0;
for($i = 0,$a = count($rows);$i<$a;$i++){
$row =& $rows[$i];
?>
<tr class="<?php echo "row$k"; ?>">
<td align="center">
<?php
global $Itemid;
$url_itemid='';
if(!empty($Itemid)){
$url_itemid='&Itemid='.$Itemid;
}
?>
<a href="<?php echo hikashop_completeLink('order&task=show&cid='.$row->order_id.$url_itemid.'&cancel_url='.urlencode(base64_encode(JRoute::_('index.php?option=com_community&view=profile&userid='.$my->id)))); ?>">
<?php echo $row->order_product_name; ?>
</a>
</td>
<td align="center">
<?php echo hikashop_getDate($row->order_created,'%Y-%m-%d %H:%M');?>
</td>
<td align="center">
<?php
//get translation
echo $statuses[$row->order_status];
?>
</td>
<td align="center">
<?php echo $currencyHelper->format($row->order_full_price,$row->order_currency_id);?>
</td>
</tr>
<?php
$k = 1-$k;
}
?>
</tbody>
</table>
<?php
return ob_get_clean();
}
function onAppDisplay(){
return $this->onProfileDisplay();
}
}
}
I changed the code as you mentioned... It is still not showing...
I can't seem to find where it is missing, but it should be working as mentioned.
<?php
/**
* @copyright Copyright (C) 2010-2011 HIKASHOP SARL - All rights reserved.
* @license www.gnu.org/licenses/gpl-3.0.html GNU/GPL
*/
defined('_JEXEC') or die('Restricted access');
if(!defined('DS'))
define('DS', DIRECTORY_SEPARATOR);
if(!@include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')){
return;
};
if(!class_exists('plgCommunityHikaShop')){
class plgCommunityHikaShop extends CApplications{
var $name = "My Orders";
var $_name = "orders";
function plgCommunityHikaShop(& $subject, $config){
parent::__construct($subject, $config);
}
function onProfileDisplay(){
$my = & JFactory::getUser();
$user =& CFactory::getActiveProfile();
//only you can see your orders
if (empty($my->id) OR empty($user) OR $my->id != $user->id) return;
//load order info
$database =& JFactory::getDBO();
$searchMap = array('a.order_id','a.order_status');
$filters = array('a.order_user_id='.hikashop_loadUser());
$order = ' ORDER BY a.order_created DESC';
$query = 'FROM '.hikashop_table('order').' AS a LEFT JOIN #__hikashop_order_product AS b ON a.order_id=b.order_id WHERE '.implode(' AND ',$filters).$order;
$database->setQuery('SELECT a.* '.$query);
$rows = $database->loadObjectList();
if(empty($rows)){
return;
}
$currencyHelper = hikashop_get('class.currency');
$trans = hikashop_get('helper.translation');
$statuses = $trans->getStatusTrans();
ob_start();
?>
<table class="hikashop_orders adminlist" cellpadding="1">
<thead>
<tr>
<th class="title" align="center">
<?php echo JText::_('ORDER_NUMBER'); ?>
</th>
<th class="title" align="center">
<?php echo JText::_('DATE'); ?>
</th>
<th class="title" align="center">
<?php echo JText::_('ORDER_STATUS'); ?>
</th>
<th class="title" align="center">
<?php echo JText::_('HIKASHOP_TOTAL'); ?>
</th>
</tr>
</thead>
<tbody>
<?php
$k = 0;
for($i = 0,$a = count($rows);$i<$a;$i++){
$row =& $rows[$i];
?>
<tr class="<?php echo "row$k"; ?>">
<td align="center">
<?php
global $Itemid;
$url_itemid='';
if(!empty($Itemid)){
$url_itemid='&Itemid='.$Itemid;
}
?>
<a href="<?php echo hikashop_completeLink('order&task=show&cid='.$row->order_id.$url_itemid.'&cancel_url='.urlencode(base64_encode(JRoute::_('index.php?option=com_community&view=profile&userid='.$my->id)))); ?>">
<?php echo $row->order_product_name; ?>
</a>
</td>
<td align="center">
<?php echo hikashop_getDate($row->order_created,'%Y-%m-%d %H:%M');?>
</td>
<td align="center">
<?php
//get translation
echo $statuses[$row->order_status];
?>
</td>
<td align="center">
<?php echo $currencyHelper->format($row->order_full_price,$row->order_currency_id);?>
</td>
</tr>
<?php
$k = 1-$k;
}
?>
</tbody>
</table>
<?php
return ob_get_clean();
}
function onAppDisplay(){
return $this->onProfileDisplay();
}
}
}
Please Log in or Create an account to join the conversation.
13 years 4 weeks ago #121908
by nicolas
Replied by nicolas on topic Order Name vs. Order Number (Community Plugin)
Ah yes, you also need to;
$database->setQuery('SELECT a.* '.$query);
to:
$database->setQuery('SELECT a.*,b.* '.$query);
$database->setQuery('SELECT a.* '.$query);
to:
$database->setQuery('SELECT a.*,b.* '.$query);
Please Log in or Create an account to join the conversation.
13 years 4 weeks ago #121962
by xsbucks
Replied by xsbucks on topic Order Name vs. Order Number (Community Plugin)
Got it! Thanks Nicolas.
Please Log in or Create an account to join the conversation.
Time to create page: 0.200 seconds