Post by wilmaogando » Fri Jul 24, 2009 12:25 am

Hi everybody, firstable i don´t speak english very well but i will try to explain myself.

I don´t know php, but i have my store in OpenCart 1.2.9
I sell perfumes and i am having a problem. Each perfume comes in differents sizes, like
1.7 ounces and 3.4 ounces.
I allready created the weight class and coversion, but if i have the both perfumes in stock
what i am doing is creating the product again, for example:
1 product: 212 perfume 1.7ounces
1 product: 212 perfume 3.4ounces

The ounces i am putting it in the camp for weight. But the problem is when a client see the product in the
store don't know wich one is because it doesn´t display weight even when they clic the product
the only information that says about the product is: Price, Availability, Model, Manufacturer and Average Rating.

The big question is: HOW CAN I MAKE THE WEIGHT BE DISPLAYED INTO DE PRODUCT INFORMATION???

OR ANY SUGESTION??

Wilma
(Don't speak english)


New member

Posts

Joined
Fri Jul 24, 2009 12:15 am
Location - Dominican Republic

Post by slawrence10 » Fri Jul 24, 2009 1:29 am

Hey

You could put it in the grey box that displays stock, model and rating average quite easily.

In cart/catalog/controller/product/product.php
after

Code: Select all

$this->data['text_wait'] = $this->language->get('text_wait');
add this line

Code: Select all

$this->data['text_weight'] = $this->language->get('text_weight');
after:

Code: Select all

$this->data['average'] = $average;
add this line:

Code: Select all

$this->data['weight'] = $product_info['weight'];
In cart/catalog/language/english/product/product.php
after

Code: Select all

$_['text_search']       = 'Search';
add

Code: Select all

$_['text_weight']       = 'Weight';
Finally in
cart/catalog/view/theme/default/template/product/product.tpl
after

Code: Select all

            <tr>
              <td><b><?php echo $text_availability; ?></b></td>
              <td><?php echo $stock; ?></td>
            </tr>
add

Code: Select all

            <tr>
              <td><b><?php echo $text_weight; ?></b></td>
              <td><?php echo $weight; ?></td>
            </tr>
Let me know how it goes

:)

Scott

View my latest OpenCart work: JD Harris and Student Textbooks Online

Scott Lawrence - web and graphic design


User avatar
Active Member

Posts

Joined
Sun Jul 19, 2009 8:10 pm
Location - London, UK

Post by wilmaogando » Sun Aug 09, 2009 1:50 am

Thank you very much slawrence10!!

Today I'am looking your answer I was waiting the answer to be received in my mail.
And today I check here and found your HELP, thanks.

It works perfectly!!!

Now another question, that weight can be shown down the name and model
in the page that list all the manufacturer products?? I don´t know if I’m explaining
myself right, so I give an example: When you select a manufacturer the web page
shows all the products it has, but each product just presents: Name, Model and Price.
Can the weight be there two??? in perfumes this is really important because the image
is the same but the difference in price is the ounces it has.

Thank, Wilma

Wilma
(Don't speak english)


New member

Posts

Joined
Fri Jul 24, 2009 12:15 am
Location - Dominican Republic

Post by slawrence10 » Sun Aug 09, 2009 2:22 am

Yes :)

go to catalog\controller\product\manufacturer.php
and add

Code: Select all

'weight'   => $result['weight'],
after this (line 81 on mine)

Code: Select all

         $this->data['products'][] = array(
          'name'    => $result['name'],
          'model'   => $result['model'],
then go to catalog\view\theme\default\template\product\manufacturer.tpl
and add this

Code: Select all

   <span style="color: #999; font-size: 11px;">
<?php echo $products[$j]['weight']; ?>
</span><br>
after this (line 26 on mine)

Code: Select all

 <a href="<?php echo $products[$j]['href']; ?>"><?php echo $products[$j]['name']; ?></a><br />
Let me know how it goes,

Scott

View my latest OpenCart work: JD Harris and Student Textbooks Online

Scott Lawrence - web and graphic design


User avatar
Active Member

Posts

Joined
Sun Jul 19, 2009 8:10 pm
Location - London, UK

Post by wilmaogando » Sun Aug 09, 2009 2:59 am

Yes it works!!! thanks again!!

But its not shown when you clic the categories, just in manufacturers, can you add me that?

Sorry for asking so much.

Wilma :-\

Wilma
(Don't speak english)


New member

Posts

Joined
Fri Jul 24, 2009 12:15 am
Location - Dominican Republic

Post by slawrence10 » Sun Aug 09, 2009 3:22 am

Basically the same just have to find the code at different lines

go to catalog\controller\product\category.php
and add

Code: Select all

'weight'   => $result['weight'],
after this (line 133 on mine)

Code: Select all

         $this->data['products'][] = array(
          'name'    => $result['name'],
          'model'   => $result['model'],
then go to catalog\view\theme\default\template\product\category.tpl
and add this

Code: Select all

   <span style="color: #999; font-size: 11px;">
<?php echo $products[$j]['weight']; ?>
</span><br>
after this (line 44 on mine)

Code: Select all

 <a href="<?php echo $products[$j]['href']; ?>"><?php echo $products[$j]['name']; ?></a><br />
Cheers

Scott

View my latest OpenCart work: JD Harris and Student Textbooks Online

Scott Lawrence - web and graphic design


User avatar
Active Member

Posts

Joined
Sun Jul 19, 2009 8:10 pm
Location - London, UK

Post by banane » Sat Aug 15, 2009 5:21 pm

sorry
does someone knows how to show the weight unit just after the weight? I found the instructions on top really valuable, but having the weight without unit isn't so useful.
I'm using opencart 1.3.2
many thanks

User avatar
New member

Posts

Joined
Fri Jul 31, 2009 6:30 pm


Post by Qphoria » Sat Aug 15, 2009 11:18 pm

^^

Yes, in the controller of each of the files above, when you do

'weight' => $result['weight'],

change it to
'weight' => $this->weight->format($result['weight'], $this->config->get('config_weight_class_id'))

OpenCart 2.0.x Mod Update Info

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by banane » Sun Aug 16, 2009 10:14 pm

thanks Qphoria
it's working but I guess there's something wrong. even if I've set different weight unit for each products, I always see the default weight unit for each product and not the right one. I've checked the weight class and seems to be ok..
and, another thing: how can I put and extra empty space between weight and unit?
many thanks!

User avatar
New member

Posts

Joined
Fri Jul 31, 2009 6:30 pm


Post by Qphoria » Sun Aug 16, 2009 11:39 pm

yea sorry.. i gave you the code for the store-wide unit, not the per product unit.

Try
'weight' => $this->weight->format($result['weight'], $result['weight_class_id'])

OpenCart 2.0.x Mod Update Info

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by banane » Mon Aug 17, 2009 12:31 am

it's working!
thanks, I really appreciated

User avatar
New member

Posts

Joined
Fri Jul 31, 2009 6:30 pm


Post by wilmaogando » Mon Aug 17, 2009 8:57 am

Thanks for that Qphoria too!!

Another question, wich files do I need to modify for this information appear in the Index page, in the section down the Welcome message, to the latest products??.

I already modify (with Scott insctruction):
catalog/controller/product/category.php
catalog/controller/product/manufacturer.php
catalog/controller/product/product.php
catalog/controller/product/search.php
catalog/controller/product/special.php
catalog/view/theme/default/template/product/product.tpl
catalog/view/theme/default/template/product/category.tpl
catalog/view/theme/default/template/product/manufacturer.tpl
catalog/view/theme/default/template/product/search.tpl
catalog/view/theme/default/template/product/special.tpl

But is not workin just appear, product name, model and price.

Thanks in advance,

Wilma

Wilma
(Don't speak english)


New member

Posts

Joined
Fri Jul 24, 2009 12:15 am
Location - Dominican Republic

Post by banane » Mon Aug 17, 2009 5:14 pm

I guess you have to modify those files:
catalog/controller/common/home.php
catalog/view/theme/default/template/common/home.tpl

User avatar
New member

Posts

Joined
Fri Jul 31, 2009 6:30 pm


Post by wilmaogando » Tue Aug 18, 2009 1:17 am

Thanks to all you it's working, it's being shown in my index too!!

But the other contribution about show the weight unit just after the weight is not working for me.
I have to be missing something.

Here I post my changes:

In: /catalog/controller/product/product.php

I add this:
$this->data['text_weight'] = $this->language->get('text_weight');

and this:
$this->data['weight'] = $product_info['weight'];

In /catalog/language/english/product/product.php

I add this:
$_['text_weight'] = 'Weight';

In /catalog/view/theme/default/template/product/product.tpl
I add this:
<tr>
<td><b><?php echo $text_weight; ?></b></td>
<td><?php echo $weight; ?></td>
</tr>

AND I MODIFY ALL THIS OTHER FILES:
with this on php: 'weight' => $result['weight'],
an this on tpl:
<span style="color: #999; font-size: 11px;">
<?php echo $products[$j]['weight']; ?>
</span><br>

catalog/controller/product/category.php
catalog/controller/product/manufacturer.php
catalog/controller/product/product.php
catalog/controller/product/search.php
catalog/controller/product/special.php
catalog/view/theme/default/template/product/product.tpl
catalog/view/theme/default/template/product/category.tpl
catalog/view/theme/default/template/product/manufacturer.tpl
catalog/view/theme/default/template/product/search.tpl
catalog/view/theme/default/template/product/special.tpl

BUT TO ADD THE weight unit I JUST CHANGE IN PHP FILES:
this: 'weight' => $result['weight'],
for this: 'weight' => $this->weight->format($result['weight'], $result['weight_class_id'])

What am I missing please?? its working for you banane right? what i did wrong?

--------------------------------------
Do anybody knows something about this question?
http://forum.opencart.com/viewtopic.php?f=24&t=5665

Wilma
(Don't speak english)


New member

Posts

Joined
Fri Jul 24, 2009 12:15 am
Location - Dominican Republic

Post by banane » Thu Aug 20, 2009 3:40 pm

I'm sorry wilmaogando but I've the same issue
I forgot to say that's working just in the index page but I can't show the weight unit in the product page..

User avatar
New member

Posts

Joined
Fri Jul 31, 2009 6:30 pm


Post by Qphoria » Thu Aug 20, 2009 7:13 pm

EDIT: catalog/controller/product/product.php
FIND:

Code: Select all

$this->data['model'] = $product_info['model'];
BEFORE, ADD:

Code: Select all

$this->data['weight'] = $product_info['weight'];

EDIT: view/theme/default/template/product/product.tpl
FIND:

Code: Select all

<tr>
  <td><b><?php echo $text_model; ?></b></td>
  <td><?php echo $model; ?></td>
</tr>
AFTER, ADD:

Code: Select all

<tr>
  <td><b>Weight:</b></td>
  <td><?php echo $weight; ?></td>
</tr>

OpenCart 2.0.x Mod Update Info

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by wilmaogando » Fri Aug 21, 2009 1:25 am

Thanks Qphoria!!! it' not working, I did that but it seems that made no difference.

Don't show anything. Is there any extra step?

Thanks in advance!!!

Wilma ::)

Wilma
(Don't speak english)


New member

Posts

Joined
Fri Jul 24, 2009 12:15 am
Location - Dominican Republic

Post by banane » Sat Aug 22, 2009 9:37 pm

I found the trick!
edit catalog/controller/product/product.php
just before

Code: Select all

$this->data['model'] = $product_info['model'];
past this:

Code: Select all

$this->data['weight'] = $this->weight->format($product_info['weight'], $product_info['weight_class_id']);
edit view/theme/default/template/product/product.tpl
add this:

Code: Select all

<tr>
<td><b><?php echo $text_weight; ?></b></td>
<td><?php echo $weight; ?></td>
</tr>
and, if you want to change the number of decimal appearing, edit system/helper/weight.php

User avatar
New member

Posts

Joined
Fri Jul 31, 2009 6:30 pm


Post by wilmaogando » Sun Aug 23, 2009 1:05 am

Hi banane, I just Tryed what you said, but I just modify:
poduct.php and product.tpl, is there any other file that need to be modify, because there is no change in my web.

Anyone can see it here: http://www.waohzone.com

The weight is being shown, but still not presenting the unit (onz.).

Please if is working for you, can you explain if there are anyother steps that maybe a no newbi would now?

Wilma
(don't speak english)

Wilma
(Don't speak english)


New member

Posts

Joined
Fri Jul 24, 2009 12:15 am
Location - Dominican Republic

Post by TBT » Sun Aug 23, 2009 9:13 am

Qphoria wrote:EDIT: catalog/controller/product/product.php
FIND:

Code: Select all

$this->data['model'] = $product_info['model'];
BEFORE, ADD:

Code: Select all

$this->data['weight'] = $product_info['weight'];

EDIT: view/theme/default/template/product/product.tpl
FIND:

Code: Select all

<tr>
  <td><b><?php echo $text_model; ?></b></td>
  <td><?php echo $model; ?></td>
</tr>
AFTER, ADD:

Code: Select all

<tr>
  <td><b>Weight:</b></td>
  <td><?php echo $weight; ?></td>
</tr>
Thanks Qphoria

Works like a charm ;D

User avatar
TBT
New member

Posts

Joined
Tue Jul 21, 2009 4:46 am

Who is online

Users browsing this forum: No registered users and 17 guests