Post by stringsetc » Fri Mar 16, 2012 9:07 pm

Hi

I've decided to try and build in an extra variable to help with my site, however, only knowing a very limited amount of php ive got halfway through and seem to have missed out an essential part of the process, defining my new variable - duhhh!!

What i want to do is create a new variable called "bestprice" . I will then call this on the product pages and also use it when populating some of my product feeds.

A lot of my products have price breaks or quanity discounts , so often, the price for 1 is not that attractive, however when listing the products on the site oc just grabs the "price" and displays that everywhere on the site, apart from the shopping cart if you qualify for a discount by buying say 3 of a particular item.

Is it possible to create a new variable called bestprice? So far i've added a new field into the mysql database and given it the same catorgristics as "price" (copy and paste job).

I've then added it to the addproduct function and editproduct function code in /public_html/admin/model/catalog/product.php
. "', price = '" . (float)$data['price'] . "', bestprice = '" . $this->db->escape($data['bestprice'])."', points = '" . (int)$data['points'] .
and also make a slight change to /public_html/admin/view/template/catalog/product_form.tpl adding in this little bit..
<tr>
<td><?php echo $entry_bestprice; ?></td>
<td><input type="text" name="bestprice" value="<?php echo $bestprice; ?>" /></td>
</tr>
now somewhat unsurpisingly, when I go into the admin backend and click on a product my new textbox appears to enter my "bestprice" variable but with the following message
Notice: Undefined variable: entry_bestprice in /home/www2/public_html/admin/view/template/catalog/product_form.tpl on line 81
my question is where do I define $entry_bestprice ?

AND

what else would I need to do to get "bestprice" displaying when I export my data to my .xls spreadsheet (where I do most of my data entry).

Anybody any ideas?

Thanks in advance.

Active Member

Posts

Joined
Thu Feb 16, 2012 11:59 pm

Post by Qphoria » Fri Mar 16, 2012 9:23 pm

So let me understand better..
You have a product for 100.00
If you buy 5 or more it goes for 90.00 each
If you buy 10 or more it goes for 70.00 each

On non-product pages (category, latest, etc) you want to show "70.00" instead of "100.00"

Is that right?

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by stringsetc » Fri Mar 16, 2012 10:02 pm

yes

and also to be able to pull this lowest price from somewhere (bearing in mind not all products have a discount) and stick it into my google products feed (not entirely in the rules but everyone seems to do it).

any ideas?

Active Member

Posts

Joined
Thu Feb 16, 2012 11:59 pm

Post by Qphoria » Fri Mar 16, 2012 11:08 pm


Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by stringsetc » Fri Mar 16, 2012 11:49 pm

ah god . thanks for that . feel a bit of a fool that my 2 hours messing around was fixed in 10 seconds but at least it now works. thanks so much.

Active Member

Posts

Joined
Thu Feb 16, 2012 11:59 pm
Who is online

Users browsing this forum: Amazon [Bot] and 73 guests