Post by Hashishim » Wed Jun 20, 2012 8:28 am

Hey Guys

Quick question, when you inserting an order on the backend (Admin)

And typing in the product, I was searching it on the coding itself (order_form.tpl) I know its within the JAVASCRIPT in the bottom by autocomplete unless I am wrong.

Anyway my products on the store couple suppliers have the same stuff just price differences and some include shipping some do not, and it is a bit tiresome to eliminate what I require so I give the customers the option.

To decipher who is from who, I created a custom product field
How do I when I type in the product name on that order form.tpl the auto complete function activates and displays list of products, I want it to be able to also next to the product name have the custom product field next to it. Please help

It will be much appreciated
:)

New member

Posts

Joined
Mon Jul 25, 2011 5:44 am

Post by Avvici » Mon Jun 25, 2012 12:47 pm

This would take some custom work in both the control and the javascript.
In the catalog/product/product.php you will see this function:

Code: Select all

public function autocomplete() {
Here you will be editing or adding to the current json array:

Code: Select all

$json[] = array(
					'product_id' => $result['product_id'],
					'name'       => html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8'),	
					'model'      => $result['model'],
					'option'     => $option_data,
					'price'      => $result['price']
				);	
You will need to pull your custom variable/field into the array by simply adding to it. How you get the data is up to you. Depending upon where you custom field is and in what table, you COULD use the existing procedure:

Code: Select all

$results = $this->model_catalog_product->getProducts($data);
In the order_from.tpl for the function

Code: Select all

$('input[name=\'product\']').autocomplete({
you will be amending the json response:

Code: Select all

response($.map(json, function(item) {
					return {
						label: item.name,
						value: item.product_id,
						model: item.model,
						option: item.option,
						price: item.price
					}
Once the custom variable is added you can choose how to display it upon AUTO FILL.

User avatar
Expert Member

Posts

Joined
Tue Apr 05, 2011 12:09 pm
Location - Asheville, NC
Who is online

Users browsing this forum: No registered users and 37 guests