Show Posts


Messages - hus2020

Pages: [1] 2
1
Support / Modify the Order Total Formula
« on: April 11, 2018, 09:56:30 PM »
Hi All,

I need to edit the way AbanteCart calculates the total. In my case, I want it to be like this:

Order Total = (Sub Total + Taxes - Account Balance ) + Shipping Fees

By default, the calculation is like this:

Order Total = (Sub Total + Taxes + Shipping Fees - Account Balance )

The first thing I played with was the Order Total Extension where is adjusted the calculation order, however, the shipping fees is always deducted from the account balance which I dont want to.

Can anyone guide which files and what do I edit? I don't mind hardcoding the formula as this is my only use case.

Thank you.


2
It is very known issue with site layout broken because of increased zoom. Elements no longer fit in the screen.

In this case, menu is wrapped to new line, and since menu has white color, you can not see it.

Needs a CSS tweak.

Can you guide on the CSS tweak?

3
Dear Support,

The menu items such as Login, Account, Cart, Checkout etc. goes missing when my browser zoom is set to above 100%. Please advice what is the reason of such occurrence. Thank you.

Note : Refer image attached

4
Development Help Needed / Shipping Cost Excluded from Account Balance
« on: April 26, 2017, 03:03:45 AM »
Hi guys,

When I buy using account balance, it deducts from subtotal+taxes+shipping. How do I change the formula so it only deducts from subtotal+taxes only. Using calculation order from Order Total extension is not working. The formula seems to be hard-coded.

5
That was the first thing I did. Sadly, that did not help at all. When I tried to find the relevant code, I see that the sort order is hard-coded at order 999. Below is the model file of 'balance.php'

I tried to simply change the sort_order but that just seems to change the display position in order summary i.e. just the display order. The calculation formula still takes account balance after sub total+shipping+taxes.

Please advice how can I come around?

Code: [Select]
<?php
/*------------------------------------------------------------------------------
  $Id$

  AbanteCart, Ideal OpenSource Ecommerce Solution
  http://www.AbanteCart.com

  Copyright © 2011-2016 Belavier Commerce LLC

  This source file is subject to Open Software License (OSL 3.0)
  License details is bundled with this package in the file LICENSE.txt.
  It is also available at this URL:
  <http://www.opensource.org/licenses/OSL-3.0>

 UPGRADE NOTE:
   Do not edit or add to this file if you wish to upgrade AbanteCart to newer
   versions in the future. If you wish to customize AbanteCart for your
   needs please refer to http://www.AbanteCart.com for more information.
------------------------------------------------------------------------------*/
if (! defined 'DIR_CORE' )) {
header 'Location: static_pages/' );
}
class 
ModelTotalBalance extends Model {
public function getTotal(&$total_data, &$total, &$taxes, &$cust_data) {

if ($this->config->get('balance_status')) {
if((float)$cust_data['used_balance']){
$total_data[] = array(
'id'         => 'balance',
'title'      => $this->language->get('text_balance_checkout'),
'text'       => '-'.$this->currency->format($cust_data['used_balance']),
'value'      => - $this->session->data['used_balance'],
'sort_order' => 999,
'total_type' => 'balance'
);
$total -= $cust_data['used_balance'];
}
}
}
}

6
Customization help / Modify Calculation Sort Order for Account Balance
« on: April 21, 2017, 06:38:17 AM »
I would like to customize the deduction of account balance. By default, account balance is always deducted from the final total; i.e. SubTotal + Taxes + Shipping.
I want the account balance to be deducted from SubTotal only.
I want the calculation to be like this for example:
Sub Total : 100
Account balance : 50 (based on available balance)
Tax : Lets sat 10% VAT at (100-50) which is 10% from 50 = 5
Shipping : Lets take flat shipping of 10.
This way the final total is : 50 + 5 + 10 = 65

Just to share by default, this is how Abantecart applies account balance
Sub total : 100
Taxes : 10% VAT from 100 = 10
Shipping : 10
Account balance : 50 (based on available balance)
This way the final total is : 100+10+10-50 = 70

How can I achieve the calculation I intend to? Please guide.

7
Hii.. Anyone kind enough to help me with this please......

8
You're a life savior man. Thank you so much.

I just have one more pending issue, on the post below. Would really appreciate your input/guidance in this matter.

http://forum.abantecart.com/index.php/topic,5450.msg23889.html#msg23889

1. open file /public_html/storefront/controller/blocks/order_summary.php
2. go to line #86
3. replace
Code: [Select]
'price'      => $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax'))),with
Code: [Select]
'price'      => $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax'))*$result['quantity']),

9
In the final checkout phase, there is an order summary displayed in top right. By default, it displays the quantity, and the per unit  price of the product. Instead of such, I want to display the total price = per unit price x no of quantity.

For example below, I am ordering 3x Apron with per unit price at 20, so the total must show 60 and not 20.
For Vest, I am ordering 2x, per unit cost is 32, so the total must show 64 and not 32.



How do I do this change. Please anyone guide me. Thank you.

10
Im running Abantecart live on my hosting package and not in an IDE. Not sure how do I debug it. When you're free can you help me look into it.
So far the code snippet that I send was just the exact copy of handling code, but modifying the variables. Im not even sure im calling the right variables.

And lets say if this way does not work, how can I just hardcode the calculation order.

I need the account balance to deduct just from the order sub total and not the final total.

I checked the code and I can not see any issue with it. Can you debug it and see if it getting called?

Check if this has correct value:
'total_type' => $this->config->get('balance_fee_total_type')

11
See how Hadling fee works and made changes to the your total
https://github.com/abantecart/abantecart-src/blob/master/public_html/storefront/model/total/handling.php#L69
I have tried to mimic the handling.php code on balance.php to be able to reflect the calculation order. However, when I upload the new balance.php file, the account balance value dissapears completely from order summary. Can anyone check my code, and pinpoint where did I do wrong.

p/s: Recap : What I want achieve is that to be able to apply account balance after sub-total immediately, and not after full order total as the default. I do not want any value such as tax etc to be deducted using account balance.

Code: [Select]
<?php
/*------------------------------------------------------------------------------
  $Id$

  AbanteCart, Ideal OpenSource Ecommerce Solution
  http://www.AbanteCart.com

  Copyright © 2011-2016 Belavier Commerce LLC

  This source file is subject to Open Software License (OSL 3.0)
  License details is bundled with this package in the file LICENSE.txt.
  It is also available at this URL:
  <http://www.opensource.org/licenses/OSL-3.0>

 UPGRADE NOTE:
   Do not edit or add to this file if you wish to upgrade AbanteCart to newer
   versions in the future. If you wish to customize AbanteCart for your
   needs please refer to http://www.AbanteCart.com for more information.
------------------------------------------------------------------------------*/
if (! defined 'DIR_CORE' )) {
header 'Location: static_pages/' );
}
class 
ModelTotalBalance extends Model {
public function getTotal(&$total_data, &$total, &$taxes, &$cust_data) {

if ($this->config->get('balance_status')){
$conf_blc_subtotal 0;
//$conf_blc_tax_id = $this->config->get('handling_tax_class_id');
$pre_total $total;

if($this->config->get('balance_prefix')=='%'){
$conf_blc_fee $pre_total*(float)$this->config->get('balance_fee')/100.00;
}else{
$conf_blc_fee = (float)$this->config->get('balance_fee');
}

$per_payment unserialize($this->config->get('balance_per_payment'));

if(is_array($per_payment)){
$customer_payment $cust_data['payment_method']['id'];
foreach($per_payment['balance_payment'] as $i=>$payment_id){
if($customer_payment==$payment_id){
if($pre_total<(float)$per_payment['balance_payment_subtotal'][$i]){
$conf_blc_subtotal = (float)$per_payment['balance_payment_subtotal'][$i];
if($per_payment['balance_payment_prefix'][$i]=='%'){
if((float)$per_payment['balance_payment_fee'][$i]>0){
$conf_blc_fee $pre_total*(float)$per_payment['balance_payment_fee'][$i]/100.00;
}
}else{
$conf_blc_fee = (float)$per_payment['balance_payment_fee'][$i];
}
break;
}
}
}
}
// if fee for payment is not set - use default fee
$conf_blc_subtotal = !$conf_blc_subtotal ? (float)$this->config->get('balance_total') : $conf_blc_subtotal;

if ($pre_total $conf_blc_subtotal && $conf_blc_fee>0) {

$this->load->language('total/balance');
$this->load->model('localisation/currency');
$total_data[] = array(
'id'         => 'balance',
'title'      => $this->language->get('text_balance'),
'text'       => $this->currency->format($conf_blc_fee),
'value'      => $conf_blc_fee,
'sort_order' => $this->config->get('balance_sort_order'),
'total_type' => $this->config->get('balance_fee_total_type')
);
//if ($conf_blc_tax_id) {
//if (!isset($taxes[$conf_blc_tax_id])) {
// $taxes[$conf_blc_tax_id]['total'] = $conf_blc_fee;
// $taxes[$conf_blc_tax_id]['tax'] = $this->tax->calcTotalTaxAmount($conf_blc_fee, $conf_blc_tax_id);
//} else {
// $taxes[$conf_blc_tax_id]['total'] += $conf_blc_fee;
// $taxes[$conf_blc_tax_id]['tax'] += $this->tax->calcTotalTaxAmount($conf_blc_fee, $conf_blc_tax_id);
//}
//}

$total += $conf_blc_fee;
}
}
}
}

12
Support / Vertical Padding between Featured Products List
« on: March 09, 2017, 09:51:51 PM »
Hi, great job abantecart team making this wonderful platform.

I have a quick question, I have quite number of featured product on my main page. The issue is the title/product name of the product is confusing to read as its hard to know its above or below the product. To prevent this confusion, I want to add vertical padding between the list so its much clearer to distinguish the products. Image below indicates where I want to add extra gap/padding. Pls advice how can I do so. Thank you.

13
This is not a bug. Balance should be always applied last in the sequence of total. Purpose of the balance applied to final order total (not sub total)
OK point taken. But then the Order Total extension becomes useless. The customization of calculation order will always be ignored. Can this be customized so it behaves similar like handling.php which always follow whatever calculation order we define. Tq.

14
General Support / Deduct Account Balance on Sub-Total and not Full Total
« on: February 24, 2017, 03:58:33 AM »
Hi guys,

I noticed the file /storefront/model/total/balance.php has some bug. The sort_order is defaulted and hard coded to 999 which makes the back end setting Extensions > Order Total to not work. In back-end if I change calculation order to 2, the balance is still deducted from Order Total and not Sub Total. Can anyone advice what changes are needed to the code below so that the calculation order that is set is respected in checkout.

Code: [Select]
<?php
/*------------------------------------------------------------------------------
  $Id$

  AbanteCart, Ideal OpenSource Ecommerce Solution
  http://www.AbanteCart.com

  Copyright © 2011-2016 Belavier Commerce LLC

  This source file is subject to Open Software License (OSL 3.0)
  License details is bundled with this package in the file LICENSE.txt.
  It is also available at this URL:
  <http://www.opensource.org/licenses/OSL-3.0>

 UPGRADE NOTE:
   Do not edit or add to this file if you wish to upgrade AbanteCart to newer
   versions in the future. If you wish to customize AbanteCart for your
   needs please refer to http://www.AbanteCart.com for more information.
------------------------------------------------------------------------------*/
if (! defined 'DIR_CORE' )) {
header 'Location: static_pages/' );
}
class 
ModelTotalBalance extends Model {
public function getTotal(&$total_data, &$total, &$taxes, &$cust_data) {

if ($this->config->get('balance_status')) {
if((float)$cust_data['used_balance']){
$total_data[] = array(
'id'         => 'balance',
'title'      => $this->language->get('text_balance_checkout'),
'text'       => '-'.$this->currency->format($cust_data['used_balance']),
'value'      => - $this->session->data['used_balance'],
'sort_order' => 999,
'total_type' => 'balance'
);
$total -= $cust_data['used_balance'];
}
}
}
}

15
Template Support / Re: ADD LOGOUT BUTTON BESIDE CHECKOUT
« on: February 14, 2017, 01:25:07 AM »
Hello.
Try to change position in Design > Menu
OMG Didnt realize it was that simple. Tq for the fast tip Basara. This software has been great.

Pages: [1] 2

Powered by SMFPacks Social Login Mod