Post by alikhan99 » Fri Jun 29, 2012 5:00 pm

Hello Friends,
I am new to Opencart and also not an expert with php.
Can you friends help me please?
i need to know how to add 2 more fields to products and display them as well.

Active Member

Posts

Joined
Fri Jun 29, 2012 4:57 pm

Post by oc-extensions » Fri Jun 29, 2012 7:27 pm

Give more details about fields.
Last edited by oc-extensions on Sat Jun 30, 2012 9:46 pm, edited 1 time in total.

Image | Extensions and Custom Development


User avatar
Active Member

Posts

Joined
Fri Jan 06, 2012 11:31 pm

Post by alikhan99 » Fri Jun 29, 2012 9:21 pm

My Product requires 2 different type of model numbers, some will have both the type of model numbers and some products will have either one.
And few more such fields

Active Member

Posts

Joined
Fri Jun 29, 2012 4:57 pm

Post by labeshops » Fri Jun 29, 2012 9:28 pm

Can you not use model for one and sku for the other?

Running Opencart v3.0.3.2 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by oc-extensions » Fri Jun 29, 2012 9:29 pm

That means you need to change structure of table "product" and add new fileds.

After that change admin/controller/product.php and template file for new fields.

Also in catalog/model/catalog/product.php you need to change addProduct , editProduct function.

In front side changes needed in catalog/controller/product/product.php and template file.

Image | Extensions and Custom Development


User avatar
Active Member

Posts

Joined
Fri Jan 06, 2012 11:31 pm

Post by alikhan99 » Fri Jun 29, 2012 10:45 pm

what about the add and update product query? will that work just by doing this?
i really have no idea about opencart except that its known to be better then all others and is flexible.

Active Member

Posts

Joined
Fri Jun 29, 2012 4:57 pm

Post by ecoleman » Fri Jun 29, 2012 11:25 pm

If you're happy to pay for this, I can do this for you in about half an hour.
PM if you're interested.

Colour Code you orders by Order Status


Active Member

Posts

Joined
Tue Dec 06, 2011 3:34 am

Post by alikhan99 » Sat Jun 30, 2012 8:04 am

I would sure be happy if i had some $$$ in hand right now but unfortunately i don't :(

Active Member

Posts

Joined
Fri Jun 29, 2012 4:57 pm

Post by labeshops » Sat Jun 30, 2012 9:09 pm

here is an extension to do what you want http://www.opencart.com/index.php?route ... order=DESC

Running Opencart v3.0.3.2 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by alikhan99 » Sun Jul 01, 2012 9:12 am

thanks dear but right now i am really broke :(
trying to follow ecoleman instructions right now ..... hope i can make it

Active Member

Posts

Joined
Fri Jun 29, 2012 4:57 pm

Post by Alsaru » Thu Apr 04, 2013 1:25 pm

As labeshops said there are fields that you could convert them to any need, like sku and model fields, and more of these since OC 1.5.4 there are plenty new fields in product form and in case you wouldn't cover all of them already, just change them the description in the language file (both admin and catalog). Now to also display them in the product.tpl (that is the front product page), you have just to echo and define them, as they are already indexed in the model file.

Open the product.tpl from the catalog/view/product.tpl with notepad++ (free) and find the line where the model is already called. Should be like:

Code: Select all

<?php echo $model; ?>
add how many fields you like (all examples taken from OC 1.5.4+ default installation)

Code: Select all

<?php echo $sku; ?>
<?php echo $ean; ?>
<?php echo $jan; ?>
<?php echo $isbn; ?>
<?php echo $mpn; ?>
.....
Now you have to define these new lines. So open up the catalog /controller/product.php and

find

Code: Select all

$this->data['model'] = $product_info['model'];
add the needed values

Code: Select all

$this->data['sku] = $product_info['sku];
$this->data['ean'] = $product_info['ean'];
.... and so on
In the same file find also

Code: Select all

$this->data['text_model'] = $this->language->get('text_model');
Add lines with sku, ean ....and so on. That is for defining the language.

And the last file to edit is catalog/language/yourlanguage/product.php

add

Code: Select all

$_['text_sku'] = 'some name here';
$_['text_ean'] = 'another name here';

.... so on
it is not so hard even for a novice (as I am :=))

New member

Posts

Joined
Wed Feb 29, 2012 1:33 am
Who is online

Users browsing this forum: No registered users and 392 guests