Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

EZ new fields v1.0


minglou

Recommended Posts

Hi All :D ,

 

I also agree that this a great mod, but being a "newbe", what is the correct SQL statement I need to add it to my database?

 

Here is what is listed in the mod...

 

1. add a table in product( database )

 

products_retail_price decimal(10,2) Null No

 

Thanks in advance everyone :!:

 

Steve

Link to comment
Share on other sites

Hi All,

 

In response to my previous post, I have figured out the correct statement.

(Smash,Smash)

 

Therefore I will share with the rest of the class... :arrow:

 

 

1. add a table in product( database )

 

products_retail_price decimal(10,2) Null No

 

Should read--->

 

ALTER TABLE `products` ADD `products_retail_price` decimal(10,2) default NULL AFTER `products_price`;

 

Hope that it helps someone else :!:

 

Steve

Link to comment
Share on other sites

Okay, the retail price shows when I preview in the administrative area, but doesn't show in the catalog.

 

When the price shows, I see only the two prices, but they are not labeled. Any help on how I can label these.

 

Finally, I would like to reverse the order they display, so that it is the Retail price first, and then our price.

 

Help on these things for a php novice and I will be very happy with this contribution!

Rick Weiss

Link to comment
Share on other sites

Sometimes when I try to work with php I make things more complicated than they are - part of the fear of working on new things.

 

Anyway, when Sean writes: "put this line: <?php echo $product_info_values['products_retail_price']; ?>

 

in anywhere you want in product_info.php"

 

I took his 'anywhere you want' too literally, and put it in a place that didn't work

Rick Weiss

Link to comment
Share on other sites

Greetings All!!

 

I have posted the working script below.

Some of the values need to be changed from Sean's original contrib.

All credit goes to Sean, I just tweeked it a bit.

Main changes are in bold.

 

===============================================

EZ new fields v1.0

 

easy way add retail price in the product_info.php

 

 

Total 3 files need change:

 

catalog/admin/includes/languages/english/categories.php

catalog/admin/categories.php

catalog/product_info.php

 

 

please backup your files first.

 

 

 

INSTALL

 

 

1. add a table in product( database )

 

ALTER TABLE `products` ADD `products_retail_price` decimal(10,2) default NULL AFTER `products_price`;

 

2. in catalog/admin/includes/languages/english/categories.php add

 

define('TEXT_PRODUCTS_RETAIL_PRICE_INFO', 'Retail Price:');

define('TEXT_PRODUCTS_RETAIL_PRICE', 'Products Retail Price:');

 

3. in catalog/admin/categories.php

 

-------------------------------------------------------------------------------------------

line:198 after this line: 'products_price' => tep_db_prepare_input($HTTP_POST_VARS['products_price']),

 

add this line: 'products_retail_price' => tep_db_prepare_input($HTTP_POST_VARS['products_retail_price']),

-------------------------------------------------------------------------------------------

line:259 about this line: $product_query = tep_db_query("select products_quantity, products_model............

 

before products_price add products_retail_price,

---------------------------------------------------------------------------------------------

line:262 about this line: tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model...................

 

before this: products_price add products_retail_price,

 

before this: '" . $product['products_price'] . add '" . $product['products_retail_price'] . "',

----------------------------------------------------------------------------------------------

line:319 about this line: $product_query = tep_db_query("select pd.products_name, pd.products_description..................

 

brfore this: p.products_price add p.products_retail_price,

-----------------------------------------------------------------------------------------------

line:458-461

 

after these lines: <tr>

<td class="main"><?php echo TEXT_PRODUCTS_PRICE; ?></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_price', $pInfo->products_price); ?></td>

</tr>

 

add there lines:

<tr>

<td class="main"><?php echo TEXT_PRODUCTS_RETAIL_PRICE; ?></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_retail_price', $pInfo->products_retail_price); ?></td>

</tr>

--------------------------------------------------------------------------------------------------

line:503 about this line: $product_query = tep_db_query("select p.products_id, pd.language_id.........................

 

before this: p.products_price add p.products_retail_price,

--------------------------------------------------------------------------------------------------

line:530 after this line: <td class="pageHeading" align="right"><?php echo $currencies->format($pInfo->products_price); ?></td>

 

add this line: <td class="pageHeading" align="right"><?php echo $currencies->format($pInfo->products_retail_price); ?></td>

---------------------------------------------------------------------------------------------------

line:692 about this line: $products_query = tep_db_query("select p.products_id, pd.products_name.......................

 

before this: p.products_price add p.products_retail_price

---------------------------------------------------------------------------------------------------

line:694 about this line: $products_query = tep_db_query("select p.products_id, pd.products_name.........................

 

before this: p.products_price add p.products_retail_price

--------------------------------------------------------------------------------------------------

line:869 replace this line: $contents[] = array('text' => '<br>' . TEXT_PRODUCTS_PRICE_INFO . ' ' . $currencies->format($pInfo->products_price) . '<br>' . TEXT_PRODUCTS_QUANTITY_INFO . ' ' . $pInfo->products_quantity);

 

by this line: $contents[] = array('text' => '<br>' . TEXT_PRODUCTS_PRICE_INFO . ' ' . $currencies->format($pInfo->products_price) . '<br>' . TEXT_PRODUCTS_RETAIL_PRICE_INFO . ' ' . $currencies->format($pInfo->products_retail_price) . '<br>' .TEXT_PRODUCTS_QUANTITY_INFO . ' ' . $pInfo->products_quantity);

--------------------------------------------------------------------------------------------------

 

 

4. in catalog/product_info.php

--------------------------------------------------------------------------------------------------

line:46 about this line: $product_info_query = tep_db_query("select p.products_id, pd.products_name................

 

before this: p.products_price add p.products_retail_price

--------------------------------------------------------------------------------------------------

put this line: <?php echo $product_info['products_retail_price']; ?>

 

in anywhere you want in product_info.php

 

Don't forget adding the Dollars Sign $ and retail price text in front this line <?php echo $product_info['products_retail_price']; ?> in product_info.php, if you want.

-------------------------------------------------------------------------------------------

 

NOTES:

 

these change works with version: product_info.php,v 1.92 2003/02/14

product_info.php,v 1.86 2002/08/02

categories.php,v 1.133 2002/06/09

 

i think these work with all versions.

 

you can following this rules and add new fields like:

 

retail price: 89.99

our price: 45.00

you save: 44.99 or 50%

 

-----------------------------------------------------------------------------

Currently working on: EZ new fileds v1.5

 

Automatically caculate the save field ( you save: 44.99 or 50% ), so you don't have to do it by youself.

 

-----------------------------------------------------------------------------

 

sean wang

6.21.2003

 

===============================================

 

Hope that helps.

 

Steve

Link to comment
Share on other sites

Hi there,

 

Thank you all, who have posted your tips, concerning this contri. I am a very new user to OSCOMMERCE and never changed something at my database. This is the first time, I touched it. Might someone have a look at it, to check, if my settings in PRODUCTS are correct?

 

Here is a screenshot of my database settings:

http://www.winediscount.ch/database.jpg

 

 

The contri does not work properly. In ADMIN/PRODUCT, I can see a new field (retail price) and so in product preview. But it has never been displayed in the catalog. Thank you for your help.

 

Greetings from Switzerland,

 

Patrick

www.winediscount.ch

 

Here is a screenshot of my database settings:

http://www.winediscount.ch/database.jpg

Link to comment
Share on other sites

Thanks for the code Steve. That was a big help.

 

If anyone has any interest in adding this information to other areas where prices are displayed (new products, what's new, product listing, etc.) let me know.

 

I'm on a tight deadline right now, but if anyone wants it I'll go back through my code in a few days and post the necessary pieces.

Link to comment
Share on other sites

If anyone has any interest in adding this information to other areas where prices are displayed (new products, what's new, product listing, etc.) let me know.

 

That would be great tpfaff.

 

Anytime you are ready, no rush.

 

Steve

Link to comment
Share on other sites

  • 2 weeks later...

I tried the original code and Steve's code and I'm getting nothing but blanks. It's outputting nothing (the value is in the DB however). Also, as far as the DB item goes, where should the field be located (relative to other items)?

Link to comment
Share on other sites

When I try to Copy a Product to another category (duplicate) - I think this is another contribution, but it looks to me like the error is coming because I did the New Fields changes - I get this error:

 

1064 - You have an error in your SQL syntax near ''' at line 1

 

insert into products (products_quantity, products_model, products_image, products_price, products_retail_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id, products_family) values ('5', '6004', '6004.gif','117.00', '82.1500', now(), '', '0.00', '0', '1', '4', '

 

[TEP STOP]

Does anyone else who is using this new field contribution also have the ability to Copy Products (in other words, do you know what contribution this is from)?

 

Do you recognize this error...so that you could give me some idea of what is casuing it?

Rick Weiss

Link to comment
Share on other sites

Hello All,

 

I have tried this hack on a fresh MS2 install and it works correctly.

 

I used the code I tweeked.

 

Some of Seans line numbers are off, so beware and BACK UP :!: :!: :!:

 

At the indicated line number, you might have to look ahead some for the correct line to replace.

 

Don't forget to add the correct dB statement in your sql dB.

 

Steve

Link to comment
Share on other sites

Hello All,

 

I have tried this hack on a fresh MS2 install and it works correctly.

 

I used the code I tweeked.

 

Some of Seans line numbers are off, so beware and BACK UP :!: :!: :!:

 

At the indicated line number, you might have to look ahead some for the correct line to replace.

 

Don't forget to add the correct dB statement in your sql dB.

 

Steve

Which SQL statement? Within what file should I look for it? I didn't mess with that at all - that could be my problem!
Link to comment
Share on other sites

Hi Kevin,

 

You need to add the following statement to your database thru mysql...

 

ALTER TABLE `products` ADD `products_retail_price` decimal(10,2) default NULL AFTER `products_price`;

 

Steve

Link to comment
Share on other sites

Hi Kevin,

 

You need to add the following statement to your database thru mysql...

 

ALTER TABLE `products` ADD `products_retail_price` decimal(10,2) default NULL AFTER `products_price`;

 

Steve

Ahhh, not a SQL query but just adding the row to the database. Yah I got that. I have the values in that field successfully too. They're just not pulling out of the DB to display on the site. I'm getting blank echo's. Any ideas?
Link to comment
Share on other sites

I figured it out. There were problems with the output code. Well not the code itself, but the variable. I simply took two original lines of code (see below) and made duplicates but changed the products_price entires to prodcuts_retail_price. It worked like a charm after that!

      $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';

to

$products_retail_price = '<s>' . $currencies->display_price($product_info['products_retail_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';

and then the else statement

$products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));

to

$products_retail_price = $currencies->display_price($product_info['products_retail_price'], tep_get_tax_rate($product_info['products_tax_class_id']));

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...