0
Hi,
I Worked hard last two days to customize your nice script (congrats!) to fit my needs.
While layout customization can be done with the templates there are some that requires the script hack. It's not a big deal for me, fortunately, but they requires to re-hack the script on every upgrade. It would be nice if you would include the following (in bold) in view/invoice/templates/default.php:
For the same reason you should process it separately
Obviously you should include those variables in the
and in
So far all the variables that european invoicing laws require (even if not everybody respect them...), so them should be there.
And it would be very nice to get all payment details available and not just "Payment" listed as invoice items (like the title of payment type, "Paypal", "Wire Transfer" and so on) and shipping details as well. Or, alternatively, fire the plugins before each "search/replace" command so user could develop a customized one without hacking the core.
I Worked hard last two days to customize your nice script (congrats!) to fit my needs.
While layout customization can be done with the templates there are some that requires the script hack. It's not a big deal for me, fortunately, but they requires to re-hack the script on every upgrade. It would be nice if you would include the following (in bold) in view/invoice/templates/default.php:
$items = "";
$taxes = "";
$payments = "";
$payments2 = "";
$subtotal = 0 ;
$netSubtotal = 0;
$totalDiscount = 0;
$netDiscountedSubtotal = 0;
$outstanding_payments = 0;
if(!empty($this->items)){
$taxesArray = array();
foreach($this->items as $item){
// product net price
$netPrice = $item->value * $item->amount;
// net subtotal
$netSubtotal += $netPrice;
// net discounted subtotal
$netDiscountedPrice = (($item->value * $item->amount) - $item->discount);
// net discounted subtotal sum
$netDiscountedSubtotal += $netDiscountedPrice;
// product tax
$item->items_tax = (($item->value * $item->amount) - $item->discount)*($item->tax/100);
// array tax regrouped
// with Hikashop $this->taxes is not valorized so the standard routine is skipped
if(!isset($taxesArray[$item->tax])) { $taxesArray[$item->tax] = $item->items_tax; }
else { $taxesArray[$item->tax] += $item->items_tax; }
For the same reason you should process it separately
if( count($taxesArray) > 0 && empty($this->taxes))
{
while(list($k,$v)=each($taxesArray))
{
if($v >0)
{
$search = array(
"{name}",
"{value}"
);
$replace = array(
$k,
InvoicesHelper::format($v, $before, $after)
);
$taxes .= str_replace($search, $replace, $this->template->taxes) ;
}
}
}
Obviously you should include those variables in the
$items .= str_replace($search, $replace, $this->template->items) ;
and in
echo str_replace($search, $replace, $this->template->content) ;
So far all the variables that european invoicing laws require (even if not everybody respect them...), so them should be there.
And it would be very nice to get all payment details available and not just "Payment" listed as invoice items (like the title of payment type, "Paypal", "Wire Transfer" and so on) and shipping details as well. Or, alternatively, fire the plugins before each "search/replace" command so user could develop a customized one without hacking the core.
Responses (4)
-
Accepted Answer
0Hello!
we will add place for the payment "charges" or shipping or other in a future version. we will also add other improvements we're working on.
your code is very good but it looks quite specific to your situation, I'm not sure this is a generalisable thing to put in the script.. thanks anyway!
very nice work by the way! I love it when people work on the script for themselves and tweak it for their needs. very good to see you have such codin skills! -
Accepted Answer
0Hi, thanks for your fast reply!
Well, as far as the variables are available I think is well generalized. Everyone who needs them can use them, otherwise they don't affect the script at all. The same for the plugin firing. It would allow a lot of expansions.
By the way, you could use placeholder as well for text (labels and so on) included in square bracket like [this_is_my_text]. With regular expression search the script could replace [this_is_my_text] with JText::_( 'THIS_IS_MY_TEXT') allowing the script to be multilingual... ;-)
I did it for a component of mine.
Best regards. -
Accepted Answer
-
Accepted Answer
Your Reply
Please login to post a reply
You will need to be logged in to be able to post a reply. Login using the form on the right or register an account if you are new here.
Register Here »