Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Devs, Gurus, I Need Help.


Delaran

Recommended Posts

Posted

Alright,

 

I've been trying to fix this for days now but can't for the life of me figure out why this is happening. I've posted a few times and gotten absolutely zero responses. I think I was too vague with what I needed help with, or maybe no one knows this besides a dev. In any case, please respond when you have time or if you don't know, even a "you can't do that" or "I don't know" would suffice at this point.

 

I've created a new database field in products named products_percase. I set the defines properly, and now I have been able to add data to this new field when creating a new product. Then, I created a new product attribute field (similar to model, quantity, price, wieght) entitled Per Case. I added it under the Configuration->Product Listing option as true, setting the sort order right after Quantity.

 

Now that I have data to pull from the database (everything has been updated with its products per case), I am stuck at this point:

 

When viewing the products for sale in a certain category, it shows the Model, Quantity, Quantity, Weight, and Price. Apparently somewhere along the line, I missed a line of code telling the new product listing option to look in the new database field for the data. I've gone through index.php with a fine toothed comb and can't for the life of me figure out why it is showing Quantity twice instead of the newly entered data.

 

If I switch the sort order so that Per Case is before Quantity, it takes on the properties of whatever is before it, so it isn't like I copied and pasted a quantity section and it retained a select statement for that field. When I switch it to a sort order before Quantity, it will begin mimicking the Model values and rename the field to Model in this format:

 

Model, Model, Quantity, Weight, Price.

 

I'm not exactly sure why this is happening. I hope someone out there has created a new product listing field before and I'm not the first to attempt this. If anyone out there knows how to do this properly, please PM me or respond to this thread so I can fix this without banging my head on the wall for another week or two.

 

Thank you! :-"

Posted
Alright,

 

I've been trying to fix this for days now but can't for the life of me figure out why this is happening. I've posted a few times and gotten absolutely zero responses. I think I was too vague with what I needed help with, or maybe no one knows this besides a dev. In any case, please respond when you have time or if you don't know, even a "you can't do that" or "I don't know" would suffice at this point.....

 

 

i dunno!

 

ha! that was a joke. but since you invited half answers, here's one. look for the bits of code that say:

 

$listing_sql = "select ....

 

these are the sql queries to the database. this is where you will need to target your attention because this is where it gets the info for the product listing.

 

i find it useful to play around with phpMyAdmin first, until i can figure out the correct SQL query, then with that in hand, i can back-translate it into the $listing_sql necessary to insert into the page (index.php).

 

for example, from my own index.php file one query looks like this:

 

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, pd.products_description, p.products_quantity, p.products_date_added, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_quantity > '0' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

 

first you have to translate that into a useable SQL command that you can enter into phpMyAdmin. the basic rule is to get rid of all the quotation marks and concats ( . , i.e. periods) and replace the variables with an actual (valid) value. so i might end up with something like this:

 

SELECT pd.products name p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, pd.products_description, p.products_quantity, p.products_date_added, IF(s.status, s.specials_new_products_price, NULL) AS specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) AS final_price from products_description pd, products p LEFT JOIN manufacturers m ON p.manufacturers_id = m.manufacturers_id, products_to_categories p2c LEFT JOIN specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_quantity > '0' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '21'

 

then run the query and you'll see what you get. now try to modify it so that it also gives you the field you're looking for. you'll probably need to add something like

p.products_percase,

in the right place, being sure to get all the commas and spaces right.

 

once you've got that sorted out just using phpMyAdmin to see what the query returns, you can go back and modify index.php so that it's got the proper queries in it. and there are likely several places you will have to modify, since index.php really represents several different pages, depending on what the customer has done.

 

i'm assuming you've already added your field into the $define_list array, and the switch ($column_list[$i]).

 

sort of a half-*** answer, but it's all i got at the moment.

 

cheers,

rj

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...