Jump to content

Commission Calculation + New Field in Back Office


Jagotic

Recommended Posts

Hello presta friends

in my project i have added new price field on product price tab. it is working great, and showing commission value per product in back office for order (See image > Ref 1).

Now i want to show total order commission below Total order value (See image > Ref 2) multiply with quantity and that can be used in customer account.

What should i do to do that now!

Note: 

I have added commission field to price tab:

	<div class="form-group">
		<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="wholesale_price" type="default"}</span></div>
		<label class="control-label col-lg-2" for="commission">
			<span class="label-tooltip" data-toggle="tooltip" title="{l s='Re-seller Commission'}">{if !$country_display_tax_label || $tax_exclude_taxe_option}{l s='Re-seller Commission'}{else}{l s='Pre-tax re-seller commission'}{/if}</span>
		</label>
		<div class="col-lg-2">
			<div class="input-group">
				<span class="input-group-addon">{$currency->prefix}{$currency->suffix}</span>
				<input maxlength="27" name="commission" id="commission" type="text" value="{{toolsConvertPrice price=$product->commission}|string_format:$priceDisplayPrecisionFormat}" onchange="this.value = this.value.replace(/,/g, '.');" />
			</div>
		</div>
	</div>

added commission to PS_PRODUCT

added coded on _product_line.tpl :

	<td>
	{($product.commission)}
	</td>

HELP WILL BE GREATLY APPRECIATED  😍

Edited by Jagotic
Attention, didn't get any help yet (see edit history)
Link to comment
Share on other sites

That's a little complicated.
To save it to an order, first you need to add it as a new field in the order-detail table. Then, you have to edit orderDetail::create so that you include the new field for each product row.
Lastly, Cart::GetOrderTotal needs a number of modifications to include that at the end, which might or might not include creating a new type (like Cart::ONLY_PRODUCTS) to get the commission, or the total with, or without.

  • Thanks 1
Link to comment
Share on other sites

Thanks for your valuable time & suggestion 😊

what i thought & done is:

Created columns(fields) on tables:

  • product : commission
  • order_detail : product_commission, unit_commission, total_commission
  • order : total_commissions

and i successfully inserted product commission using your newfield tutorial.

Now, the challenge is, i don't know how to insert orderDetail value as and Cart::GetOrderTotal in db as you supposed. I don't php that much. have little knowledge

 

Your descriptive help will save me and take me to the next level of prestashop.

Thanks

Edited by Jagotic
miss spelled column named of order. total_commission to total_commissions (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...