- Posts: 45
- Thank you received: 0
Place discount in column in cart
- Squashtoppertje
-
Topic Author
- Offline
Less
More
10 years 11 months ago #219520
by Squashtoppertje
Place discount in column in cart was created by Squashtoppertje
-- HikaShop version -- : 2.6.0. Business
Hi,
In the cart I want to place the discount percentage in a separate column (td) after the price. I know how to edit the column header (th), but how can I add the discount in the rows per product?
Thanks!
Hi,
In the cart I want to place the discount percentage in a separate column (td) after the price. I know how to edit the column header (th), but how can I add the discount in the rows per product?
Thanks!
Please Log in or Create an account to join the conversation.
10 years 11 months ago #219541
by Xavier
Replied by Xavier on topic Place discount in column in cart
Hi,
You can use this code to display the discount percentage:
You just have to place that code in the php foreach listing all the products.
You can use this code to display the discount percentage:
Code:
</td>
<?php
if(isset($row->discount->discount_percent_amount))
echo (int)$row->discount->discount_percent_amount.'%';
?>
</td>
You just have to place that code in the php foreach listing all the products.
Please Log in or Create an account to join the conversation.
- Squashtoppertje
-
Topic Author
- Offline
Less
More
- Posts: 45
- Thank you received: 0
10 years 11 months ago #219659
by Squashtoppertje
Replied by Squashtoppertje on topic Place discount in column in cart
Okay, can you give me a hint where to add it if I wish to add it to the product listing?
Listing_price.php? And where would you put it? Around what line?
Thanks!
Listing_price.php? And where would you put it? Around what line?
Thanks!
Please Log in or Create an account to join the conversation.
10 years 11 months ago #219664
by Xavier
Replied by Xavier on topic Place discount in column in cart
Hi,
To add the discount percentage in the cart module, the view to edit is "product / cart" and add the code near the line: 482
In the cart of the checkout the view is "checkout / cart", line: 211
In the cart display menu "cart / showcart" line: 438 (in this case use $cart->...)
To add the discount percentage in the cart module, the view to edit is "product / cart" and add the code near the line: 482
In the cart of the checkout the view is "checkout / cart", line: 211
In the cart display menu "cart / showcart" line: 438 (in this case use $cart->...)
The following user(s) said Thank You: Squashtoppertje
Please Log in or Create an account to join the conversation.
- Squashtoppertje
-
Topic Author
- Offline
Less
More
- Posts: 45
- Thank you received: 0
10 years 10 months ago #220093
by Squashtoppertje
Replied by Squashtoppertje on topic Place discount in column in cart
Thanks. And how can I get rid of the percentage next to the price?
Because now I still have, for instance:
Price | Discount
€ 25 -50% | 50%
So the first column is the original display with price and discount.
Thanks again.
Because now I still have, for instance:
Price | Discount
€ 25 -50% | 50%
So the first column is the original display with price and discount.
Thanks again.
Please Log in or Create an account to join the conversation.
- Squashtoppertje
-
Topic Author
- Offline
Less
More
- Posts: 45
- Thank you received: 0
10 years 10 months ago - 10 years 10 months ago #220132
by Squashtoppertje
Replied by Squashtoppertje on topic Place discount in column in cart
I solved this by commenting out the complete part related to discounts in listing_price.php. I don't know if it is the best solution, but it does work.
However this does trigger a new question: how to add the price before discount in a separate column in table listing?
EDIT: Solved this to! Using MSRP-field:
However this does trigger a new question: how to add the price before discount in a separate column in table listing?
EDIT: Solved this to! Using MSRP-field:
Code:
<td>
<span class="hikashop_product_msrp_price hikashop_product_price_full">
<?php
$mainCurr = $this->currencyHelper->mainCurrency();
$app = JFactory::getApplication();
$currCurrency = $app->getUserState( HIKASHOP_COMPONENT.'.currency_id', $mainCurr );
$msrpCurrencied = $this->currencyHelper->convertUniquePrice($this->row->product_msrp,$mainCurr,$currCurrency);
if($msrpCurrencied == $this->row->product_msrp)
echo $this->currencyHelper->format($this->row->product_msrp,$mainCurr);
else
echo $this->currencyHelper->format($msrpCurrencied,$currCurrency).' ('.$this->currencyHelper->format($this->row->product_msrp,$mainCurr).')';
?>
</span>
<?php // } ?>
</td>
Last edit: 10 years 10 months ago by Squashtoppertje. Reason: Solved
Please Log in or Create an account to join the conversation.
10 years 10 months ago #220136
by Xavier
Replied by Xavier on topic Place discount in column in cart
Hi,
You have to edit the view "product / listing_table" and do the same thing than in the "product / cart" view.
You have to edit the view "product / listing_table" and do the same thing than in the "product / cart" view.
The following user(s) said Thank You: Squashtoppertje
Please Log in or Create an account to join the conversation.
- Squashtoppertje
-
Topic Author
- Offline
Less
More
- Posts: 45
- Thank you received: 0
10 years 10 months ago #220227
by Squashtoppertje
Replied by Squashtoppertje on topic Place discount in column in cart
Hi Xavier,
Something strange happens: I added separate columns for the product code and the MSRP-price and in both cases in the first row the code and price are empty. If I select another product the same happens, only with the first code or MSRP price. See image.
This is the added code for the product code in the showcart.php:
And this code for the MSRP price:
How can I solve this?
Thanks again!
Something strange happens: I added separate columns for the product code and the MSRP-price and in both cases in the first row the code and price are empty. If I select another product the same happens, only with the first code or MSRP price. See image.
This is the added code for the product code in the showcart.php:
Code:
<tr class="hikashop_show_cart row<?php echo $k; if((int)$cart->cart_product_quantity == 0) echo " hika_wishlist_green";?>">
<td data-title="<?php echo JText::_('HIKA_NUM'); ?>" align="center"><?php echo $i; ?></td>
<!-- ADDED -->
<td class="hikashop_product_code_row">
<?php echo $this->row->product_code; ?>
</td>
<!-- END ADDED -->
And this code for the MSRP price:
Code:
</td>
<!-- ADDED -->
<td>
<?php
// if(isset($this->element->main->product_msrp) && !(@$this->row->product_msrp > 0.0) )
// $this->row->product_msrp = $this->element->main->product_msrp;
// if(isset($this->row->product_msrp) && @$this->row->product_msrp > 0.0 && JRequest::getCmd('layout') == 'show' && $this->params->get('from_module','') == ''){ ?>
<span class="hikashop_product_msrp_price hikashop_product_price_full">
<span class="hikashop_product_msrp_price_title">
<?php
// echo JText::_('PRODUCT_MSRP_BEFORE');
?>
</span>
<?php
$mainCurr = $this->currencyHelper->mainCurrency();
$app = JFactory::getApplication();
$currCurrency = $app->getUserState( HIKASHOP_COMPONENT.'.currency_id', $mainCurr );
$msrpCurrencied = $this->currencyHelper->convertUniquePrice($this->row->product_msrp,$mainCurr,$currCurrency);
if($msrpCurrencied == $this->row->product_msrp)
echo $this->currencyHelper->format($this->row->product_msrp,$mainCurr);
else
echo $this->currencyHelper->format($msrpCurrencied,$currCurrency); //.' ('.$this->currencyHelper->format($this->row->product_msrp,$mainCurr).')';
?>
</span>
<?php // } ?>
</td>
<!-- END ADDITION -->
<td data-title="<?php echo JText::_('CART_PRODUCT_UNIT_PRICE'); ?>" align="right">
How can I solve this?
Thanks again!
Please Log in or Create an account to join the conversation.
10 years 10 months ago #220289
by nicolas
Replied by nicolas on topic Place discount in column in cart
Hi,
The problem is that $this->row doesn't exist when you try to use it.
You should use instead $cart in your code and it will work.
The problem is that $this->row doesn't exist when you try to use it.
You should use instead $cart in your code and it will work.
The following user(s) said Thank You: Squashtoppertje
Please Log in or Create an account to join the conversation.
- Squashtoppertje
-
Topic Author
- Offline
Less
More
- Posts: 45
- Thank you received: 0
10 years 10 months ago #220316
by Squashtoppertje
Replied by Squashtoppertje on topic Place discount in column in cart
YES! Thanks, this works!
You know, you offer great support, but there's one thing I miss (or maybe just haven't found yet): a list with all possible calls/data per view. That would be really handy.
You know, you offer great support, but there's one thing I miss (or maybe just haven't found yet): a list with all possible calls/data per view. That would be really handy.
Please Log in or Create an account to join the conversation.
10 years 10 months ago #220338
by nicolas
Replied by nicolas on topic Place discount in column in cart
Hi,
Our documentation is focused towards users not developers. For developers we have a somewhat scarce documentation for the most important things but developers are capable of finding additional information themselves and they can always ask us if necessary.
For the variables available in a view, you can look at the code there and do var_dumps of them. And for the functions available in HikaShop, you basically want to use the hikashop_get function to load classes/helpers and you can look in the administrator/components/com_hikashop/classes and administrator/components/com_hikashop/helpers for all the functions available through that, which basically covers all the necessary functions you would need.
Our documentation is focused towards users not developers. For developers we have a somewhat scarce documentation for the most important things but developers are capable of finding additional information themselves and they can always ask us if necessary.
For the variables available in a view, you can look at the code there and do var_dumps of them. And for the functions available in HikaShop, you basically want to use the hikashop_get function to load classes/helpers and you can look in the administrator/components/com_hikashop/classes and administrator/components/com_hikashop/helpers for all the functions available through that, which basically covers all the necessary functions you would need.
The following user(s) said Thank You: Squashtoppertje
Please Log in or Create an account to join the conversation.
- Squashtoppertje
-
Topic Author
- Offline
Less
More
- Posts: 45
- Thank you received: 0
10 years 10 months ago #220355
by Squashtoppertje
Replied by Squashtoppertje on topic Place discount in column in cart
Thanks. In this case I'm stuck somewhere in the middle between a user and a developer, but I'm learning...
Please Log in or Create an account to join the conversation.
Time to create page: 0.267 seconds