Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Specials & Products_new


jsi

Recommended Posts

  • 1 month later...

Has anyone gotten this contribution to work properly? I made the changes, but the listing showed categories that had no new products added to them. Also the instructions left out which query to find in the specials.php. I was able to locate it and updated the instructions, but if anyone else has any addtional improvements please post them here or make a new rev of this contrib and put it on the oscommerce site

 

code with complete instructions (not working 100% for me, but might work for others because the author says it works for "older sites")

 

Specials & Products_new sort category & sub-category dropdown menu

 

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

Products_new / What will it do?

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

 

(Example) Currently if you had 1000 items in your site and a customer clicked on your Products_new.php page,

they would get a list of your hole site, pretty much of 1000 items 50 items in Specials.

 

They are shown in the order they

have been inserted, just in (reverse) latest first. You guys know what I mean.

 

So, if a customer wanted to see your latest products in a particular category / sub-category

they will probably have to browse through 20 or 30 pages. That would NOT be me! So, chances

are that you will lose a potencial sale with me.

 

Products_new dropdown menu mod is the solution to this issue.

 

1). Once a Customer clicks on Products_new.php your page will still display your 1000 items by pages.

+ a dropdown menu on the top of your page that will allow you to sort your 1000 items by categories.

 

2). That said,(Example) customer selects category (DVD Movies), page will refresh and show all product

in DVD Movies category in the order they have been inserted, just in (reverse) latest first.

 

3). Here's where it gets better! Now the customer is viewing all your DVDs in said category. The dropdown

menu will now allow the customer to sort the DVDs by Sub-categories in the order they have been inserted,

just in (reverse) latest first.

 

 

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

Specials / What will it do?

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

 

It is basicly the same as Products_new. (Example) Currently if you had 50 items in Specials and a

customer clicked on your specials.php page, they would get a list of all 50 items in Specials.

 

So, if a customer wanted to see your specials in a particular category / sub-category

they will probably have to browse more than they need to. So, chances are that you can lose a potencial

sale in the long run.

 

Again, Specials dropdown menu mod is the solution to this issue.

 

1). Once a Customer clicks on specials.php your page will still display 50 Special items.

+ a dropdown menu on the top of your page that will allow you to sort those 50 Special items by categories.

 

2). That said,(Example) customer selects category (DVD Movies), page will refresh and show all DVDs

with specials in DVD Movies category.

 

3). Here's where it gets better! Now the customer is viewing all your DVDs with specials in said category.

The dropdown menu will now allow the customer to sort the DVDs with specials by Sub-categories.

 

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

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

 

 

Awsome Script!!!! I had it costome made for my site couple years ago.

 

It will work for older versions Oscommerce, see it in action in the test site listed below.

For some reason it will not work for the latest versions of Oscommerce.

 

Someone with the knowledge & skills can fix this with eys closed.

 

By next month I will finish a keyword coded advance search result page w/ dropdown menu

to do the same as specials & products_new

 

www.youregiftbasket.com/specials.php

www.youregiftbasket.com/products_new.php

 

 

Guys, feel free to add on to these scrips. ENJOY!!!!!!!!!!!!!!!!!!!

 

This is a no brainner install, 1 cut & paste -- and -- 1 piece of script replaced

 

SIMPLE but allways, BACKUP!!!BACKUP!!!BACKUP!!!BACKUP!!! your files before!!!

 

It works for me, see test site

 

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

Install Products_new.php

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

 

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

On about line 45

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

 

Find: <?php echo HEADING_TITLE; ?>

 

immidiately after insert:

 

 

 

</td>

<td class="pageHeading" align="right">

<FORM>

<?php

$cat_id1=0;

$chkSub1 = 0;

$conn1 = mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD) or die ('Error connecting to mysql');

mysql_select_db(DB_DATABASE);

 

if (isset($categories_id)){

if (!empty($categories_id) && $categories_id!=""){

$rst = mysql_query("SELECT parent_id FROM categories WHERE categories_id = ".$categories_id);

if(mysql_num_rows($rst) > 0){

$rparent = mysql_fetch_object($rst);

if($rparent->parent_id > 0){

$cat_id1 = $rparent->parent_id;

}

else{

$cat_id1 = $categories_id;

}

}

else{

$cat_id1 = $categories_id;

}

}

else{

$cat_id1 = $categories_id;

}

}

else{

$cat_id1 = $categories_id;

}

 

if (isset($categories_id)){

if (empty($categories_id) && $categories_id==""){

//$result = mysql_query("SELECT CD.*, C.* FROM categories AS C, categories_description AS CD WHERE CD.language_id=1 AND C.categories_id = CD.categories_id AND C.parent_id=0");

$result = mysql_query("select distinct CD.categories_id, CD.categories_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, categories AS C, categories_description AS CD, products_to_categories as pc where CD.language_id=1 AND p.products_status = '1' AND C.categories_id = CD.categories_id AND C.parent_id=0 and p.products_id = pc.products_id and pc.categories_id = C.categories_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");

}

else{

//$result = mysql_query("SELECT CD.*, C.* FROM categories AS C, categories_description AS CD WHERE CD.language_id=1 AND C.categories_id = CD.categories_id AND C.parent_id=$cat_id1");

$result = mysql_query("select distinct CD.categories_id, CD.categories_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, categories AS C, categories_description AS CD, products_to_categories as pc where CD.language_id=1 AND p.products_status = '1' AND C.categories_id = CD.categories_id AND C.parent_id=$cat_id1 and p.products_id = pc.products_id and pc.categories_id = C.categories_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");

$chkSub1 = 1;

}

}

else{

//$result = mysql_query("SELECT CD.*, C.* FROM categories AS C, categories_description AS CD WHERE CD.language_id=1 AND C.categories_id = CD.categories_id AND C.parent_id=0");

$result = mysql_query("select distinct CD.categories_id, CD.categories_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, categories AS C, categories_description AS CD, products_to_categories as pc where CD.language_id=1 AND p.products_status = '1' AND C.categories_id = CD.categories_id AND C.parent_id=0 and p.products_id = pc.products_id and pc.categories_id = C.categories_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");

}

//print("<br><br>select distinct CD.categories_id, CD.categories_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, categories AS C, categories_description AS CD, products_to_categories as pc where CD.language_id=1 AND p.products_status = '1' AND C.categories_id = CD.categories_id AND C.parent_id=0 and p.products_id = pc.products_id and pc.categories_id = C.categories_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name");

//$result = mysql_query("SELECT CD.*, C.* FROM categories AS C, categories_description AS CD WHERE CD.language_id=1 AND C.categories_id = CD.categories_id AND C.parent_id=0");

?>

 

<SELECT NAME="clicklist"style="background-color:#F0F1F4" onChange="location.href=this.form.clicklist.options[this.form.clicklist.selectedIndex

].value">

<?php

if ($chkSub1 == 1){

?>

<OPTION>Sub-categories

<?php

}

else{

?>

<OPTION>Select by category

<?php

}

?>

<option>----------------------

<?php

while ($row = mysql_fetch_object($result)) {

print('<option value="products_new.php?categories_id='.$row->categories_id.'&inc_subcat=1&manufacturers_id">'.$row->categories_name);

}

mysql_free_result($result);

?>

<option value="products_new.php?categories_id=&inc_subcat=1&manufacturers_id">View All

</SELECT NAME></form></div>

 

 

-----

Find:

-----

 

<?php

$products_new_array = array();

 

$products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";

$products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW);

 

if (($products_new_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {

?>

 

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

And replace with:

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

 

<?php

$products_new_array = array();

if (isset($categories_id)){

if (empty($categories_id) && $categories_id==""){

$products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";

}

else{

$products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " pcat, " . TABLE_CATEGORIES . " cat where p.products_status = '1' and p.products_id = pcat.products_id and pcat.categories_id = cat.categories_id and ((cat.categories_id = " . $categories_id . " or cat.parent_id = " . $categories_id . ")) and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";

}

}

else{

$products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";

}

$products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW);

 

if (($products_new_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {

?>

 

 

 

 

 

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

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

 

 

 

 

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

Install specials.php

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

 

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

On about line 45

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

 

Find: <?php echo HEADING_TITLE; ?>

 

immidiately after insert:

 

</td>

<td class="pageHeading" align="right">

 

<FORM><?php

$cat_id1=0;

$chkSub1 = 0;

$conn1 = mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD) or die ('Error connecting to mysql');

mysql_select_db(DB_DATABASE);

 

if (isset($categories_id)){

if (!empty($categories_id) && $categories_id!=""){

$rst = mysql_query("SELECT parent_id FROM categories WHERE categories_id = ".$categories_id);

if(mysql_num_rows($rst) > 0){

$rparent = mysql_fetch_object($rst);

if($rparent->parent_id > 0){

$cat_id1 = $rparent->parent_id;

$chkSub1 = 1;

}

else{

$cat_id1 = $categories_id;

}

}

else{

$cat_id1 = $categories_id;

}

}

else{

$cat_id1 = $categories_id;

}

}

else{

$cat_id1 = $categories_id;

}

 

if (isset($categories_id)){

if (empty($categories_id) && $categories_id==""){

//$result = mysql_query("SELECT CD.*, C.* FROM categories AS C, categories_description AS CD WHERE CD.language_id=1 AND C.categories_id = CD.categories_id AND C.parent_id=0");

$result = mysql_query("select distinct CD.categories_id, CD.categories_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s, categories AS C, categories_description AS CD, products_to_categories as pc where CD.language_id=1 AND p.products_status = '1' AND C.categories_id = CD.categories_id AND C.parent_id=0 and p.products_id = pc.products_id and pc.categories_id = C.categories_id and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1'");

}

else{

//$result = mysql_query("SELECT CD.*, C.* FROM categories AS C, categories_description AS CD WHERE CD.language_id=1 AND C.categories_id = CD.categories_id AND C.parent_id=".$cat_id1);

$result = mysql_query("select distinct CD.categories_id, CD.categories_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s, categories AS C, categories_description AS CD, products_to_categories as pc where CD.language_id=1 AND p.products_status = '1' AND C.categories_id = CD.categories_id AND C.parent_id=".$cat_id1." and p.products_id = pc.products_id and pc.categories_id = C.categories_id and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1'");

$chkSub1 = 1;

}

}

else{

//$result = mysql_query("SELECT CD.*, C.* FROM categories AS C, categories_description AS CD WHERE CD.language_id=1 AND C.categories_id = CD.categories_id AND C.parent_id=0");

$result = mysql_query("select distinct CD.categories_id, CD.categories_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s, categories AS C, categories_description AS CD, products_to_categories as pc where CD.language_id=1 AND p.products_status = '1' AND C.categories_id = CD.categories_id AND C.parent_id=0 and p.products_id = pc.products_id and pc.categories_id = C.categories_id and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1'");

}

//print("<br><br>select distinct CD.categories_id, CD.categories_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s, categories AS C, categories_description AS CD, products_to_categories as pc where CD.language_id=1 AND p.products_status = '1' AND C.categories_id = CD.categories_id AND C.parent_id=0 and p.products_id = pc.products_id and pc.categories_id = C.categories_id and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1'");

//$result = mysql_query("SELECT CD.*, C.* FROM categories AS C, categories_description AS CD WHERE CD.language_id=1 AND C.categories_id = CD.categories_id AND C.parent_id=0");

?>

<SELECT NAME="clicklist"style="background-color:#F0F1F4" onChange="location.href=this.form.clicklist.options[this.form.clicklist.selectedIndex

].value">

<?php

if ($chkSub1 == 1){

?>

<OPTION>Sub-categories

<?php

}

else{

?>

<OPTION>Select by category

<?php

}

?>

<option>----------------------

<?php

while($row=mysql_fetch_object($result)) {

print('<option value="specials.php?categories_id='.$row->categories_id.'&inc_subcat=1&manufacturers_id">'.$row->categories_name);

}

//mysql_free_result($result);

?>

<option value="specials.php?categories_id=&inc_subcat=1&manufacturers_id">View All

</SELECT NAME></form>

 

 

-----

Find:

-----

 

<?php

$specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC";

$specials_split = new splitPageResults($specials_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS);

 

if (($specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {

?>

 

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

And replace with:

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

 

<?php

if (isset($categories_id)){

if (empty($categories_id) && $categories_id==""){

$specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC";

}

else{

$specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s, " . TABLE_PRODUCTS_TO_CATEGORIES . " pcat, " . TABLE_CATEGORIES . " cat where p.products_status = '1' and p.products_id = pcat.products_id and pcat.categories_id = cat.categories_id and ((cat.categories_id = " . $categories_id . " or cat.parent_id = " . $categories_id . ")) and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC";

}

}

else{

$specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC";

}

$specials_split = new splitPageResults($specials_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS);

 

if (($specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {

?>

Link to comment
Share on other sites

  • 6 months later...
Has anyone gotten this contribution to work properly? I made the changes, but the listing showed categories that had no new products added to them. Also the instructions left out which query to find in the specials.php. I was able to locate it and updated the instructions, but if anyone else has any addtional improvements please post them here or make a new rev of this contrib and put it on the oscommerce site

 

code with complete instructions (not working 100% for me, but might work for others because the author says it works for "older sites")

 

Specials & Products_new sort category & sub-category dropdown menu

 

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

Products_new / What will it do?

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

 

(Example) Currently if you had 1000 items in your site and a customer clicked on your Products_new.php page,

they would get a list of your hole site, pretty much of 1000 items 50 items in Specials.

 

They are shown in the order they

have been inserted, just in (reverse) latest first. You guys know what I mean.

 

So, if a customer wanted to see your latest products in a particular category / sub-category

they will probably have to browse through 20 or 30 pages. That would NOT be me! So, chances

are that you will lose a potencial sale with me.

 

Products_new dropdown menu mod is the solution to this issue.

 

1). Once a Customer clicks on Products_new.php your page will still display your 1000 items by pages.

+ a dropdown menu on the top of your page that will allow you to sort your 1000 items by categories.

 

2). That said,(Example) customer selects category (DVD Movies), page will refresh and show all product

in DVD Movies category in the order they have been inserted, just in (reverse) latest first.

 

3). Here's where it gets better! Now the customer is viewing all your DVDs in said category. The dropdown

menu will now allow the customer to sort the DVDs by Sub-categories in the order they have been inserted,

just in (reverse) latest first.

 

 

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

Specials / What will it do?

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

 

It is basicly the same as Products_new. (Example) Currently if you had 50 items in Specials and a

customer clicked on your specials.php page, they would get a list of all 50 items in Specials.

 

So, if a customer wanted to see your specials in a particular category / sub-category

they will probably have to browse more than they need to. So, chances are that you can lose a potencial

sale in the long run.

 

Again, Specials dropdown menu mod is the solution to this issue.

 

1). Once a Customer clicks on specials.php your page will still display 50 Special items.

+ a dropdown menu on the top of your page that will allow you to sort those 50 Special items by categories.

 

2). That said,(Example) customer selects category (DVD Movies), page will refresh and show all DVDs

with specials in DVD Movies category.

 

3). Here's where it gets better! Now the customer is viewing all your DVDs with specials in said category.

The dropdown menu will now allow the customer to sort the DVDs with specials by Sub-categories.

 

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

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

 

 

Awsome Script!!!! I had it costome made for my site couple years ago.

 

It will work for older versions Oscommerce, see it in action in the test site listed below.

For some reason it will not work for the latest versions of Oscommerce.

 

Someone with the knowledge & skills can fix this with eys closed.

 

By next month I will finish a keyword coded advance search result page w/ dropdown menu

to do the same as specials & products_new

 

www.youregiftbasket.com/specials.php

www.youregiftbasket.com/products_new.php

 

 

Guys, feel free to add on to these scrips. ENJOY!!!!!!!!!!!!!!!!!!!

 

This is a no brainner install, 1 cut & paste -- and -- 1 piece of script replaced

 

SIMPLE but allways, BACKUP!!!BACKUP!!!BACKUP!!!BACKUP!!! your files before!!!

 

It works for me, see test site

 

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

Install Products_new.php

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

 

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

On about line 45

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

 

Find: <?php echo HEADING_TITLE; ?>

 

immidiately after insert:

 

 

 

</td>

<td class="pageHeading" align="right">

<FORM>

<?php

$cat_id1=0;

$chkSub1 = 0;

$conn1 = mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD) or die ('Error connecting to mysql');

mysql_select_db(DB_DATABASE);

 

if (isset($categories_id)){

if (!empty($categories_id) && $categories_id!=""){

$rst = mysql_query("SELECT parent_id FROM categories WHERE categories_id = ".$categories_id);

if(mysql_num_rows($rst) > 0){

$rparent = mysql_fetch_object($rst);

if($rparent->parent_id > 0){

$cat_id1 = $rparent->parent_id;

}

else{

$cat_id1 = $categories_id;

}

}

else{

$cat_id1 = $categories_id;

}

}

else{

$cat_id1 = $categories_id;

}

}

else{

$cat_id1 = $categories_id;

}

 

if (isset($categories_id)){

if (empty($categories_id) && $categories_id==""){

//$result = mysql_query("SELECT CD.*, C.* FROM categories AS C, categories_description AS CD WHERE CD.language_id=1 AND C.categories_id = CD.categories_id AND C.parent_id=0");

$result = mysql_query("select distinct CD.categories_id, CD.categories_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, categories AS C, categories_description AS CD, products_to_categories as pc where CD.language_id=1 AND p.products_status = '1' AND C.categories_id = CD.categories_id AND C.parent_id=0 and p.products_id = pc.products_id and pc.categories_id = C.categories_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");

}

else{

//$result = mysql_query("SELECT CD.*, C.* FROM categories AS C, categories_description AS CD WHERE CD.language_id=1 AND C.categories_id = CD.categories_id AND C.parent_id=$cat_id1");

$result = mysql_query("select distinct CD.categories_id, CD.categories_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, categories AS C, categories_description AS CD, products_to_categories as pc where CD.language_id=1 AND p.products_status = '1' AND C.categories_id = CD.categories_id AND C.parent_id=$cat_id1 and p.products_id = pc.products_id and pc.categories_id = C.categories_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");

$chkSub1 = 1;

}

}

else{

//$result = mysql_query("SELECT CD.*, C.* FROM categories AS C, categories_description AS CD WHERE CD.language_id=1 AND C.categories_id = CD.categories_id AND C.parent_id=0");

$result = mysql_query("select distinct CD.categories_id, CD.categories_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, categories AS C, categories_description AS CD, products_to_categories as pc where CD.language_id=1 AND p.products_status = '1' AND C.categories_id = CD.categories_id AND C.parent_id=0 and p.products_id = pc.products_id and pc.categories_id = C.categories_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");

}

//print("<br><br>select distinct CD.categories_id, CD.categories_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, categories AS C, categories_description AS CD, products_to_categories as pc where CD.language_id=1 AND p.products_status = '1' AND C.categories_id = CD.categories_id AND C.parent_id=0 and p.products_id = pc.products_id and pc.categories_id = C.categories_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name");

//$result = mysql_query("SELECT CD.*, C.* FROM categories AS C, categories_description AS CD WHERE CD.language_id=1 AND C.categories_id = CD.categories_id AND C.parent_id=0");

?>

 

<SELECT NAME="clicklist"style="background-color:#F0F1F4" onChange="location.href=this.form.clicklist.options[this.form.clicklist.selectedIndex

].value">

<?php

if ($chkSub1 == 1){

?>

<OPTION>Sub-categories

<?php

}

else{

?>

<OPTION>Select by category

<?php

}

?>

<option>----------------------

<?php

while ($row = mysql_fetch_object($result)) {

print('<option value="products_new.php?categories_id='.$row->categories_id.'&inc_subcat=1&manufacturers_id">'.$row->categories_name);

}

mysql_free_result($result);

?>

<option value="products_new.php?categories_id=&inc_subcat=1&manufacturers_id">View All

</SELECT NAME></form></div>

 

 

-----

Find:

-----

 

<?php

$products_new_array = array();

 

$products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";

$products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW);

 

if (($products_new_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {

?>

 

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

And replace with:

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

 

<?php

$products_new_array = array();

if (isset($categories_id)){

if (empty($categories_id) && $categories_id==""){

$products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";

}

else{

$products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " pcat, " . TABLE_CATEGORIES . " cat where p.products_status = '1' and p.products_id = pcat.products_id and pcat.categories_id = cat.categories_id and ((cat.categories_id = " . $categories_id . " or cat.parent_id = " . $categories_id . ")) and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";

}

}

else{

$products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";

}

$products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW);

 

if (($products_new_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {

?>

 

 

 

 

 

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

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

 

 

 

 

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

Install specials.php

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

 

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

On about line 45

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

 

Find: <?php echo HEADING_TITLE; ?>

 

immidiately after insert:

 

</td>

<td class="pageHeading" align="right">

 

<FORM><?php

$cat_id1=0;

$chkSub1 = 0;

$conn1 = mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD) or die ('Error connecting to mysql');

mysql_select_db(DB_DATABASE);

 

if (isset($categories_id)){

if (!empty($categories_id) && $categories_id!=""){

$rst = mysql_query("SELECT parent_id FROM categories WHERE categories_id = ".$categories_id);

if(mysql_num_rows($rst) > 0){

$rparent = mysql_fetch_object($rst);

if($rparent->parent_id > 0){

$cat_id1 = $rparent->parent_id;

$chkSub1 = 1;

}

else{

$cat_id1 = $categories_id;

}

}

else{

$cat_id1 = $categories_id;

}

}

else{

$cat_id1 = $categories_id;

}

}

else{

$cat_id1 = $categories_id;

}

 

if (isset($categories_id)){

if (empty($categories_id) && $categories_id==""){

//$result = mysql_query("SELECT CD.*, C.* FROM categories AS C, categories_description AS CD WHERE CD.language_id=1 AND C.categories_id = CD.categories_id AND C.parent_id=0");

$result = mysql_query("select distinct CD.categories_id, CD.categories_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s, categories AS C, categories_description AS CD, products_to_categories as pc where CD.language_id=1 AND p.products_status = '1' AND C.categories_id = CD.categories_id AND C.parent_id=0 and p.products_id = pc.products_id and pc.categories_id = C.categories_id and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1'");

}

else{

//$result = mysql_query("SELECT CD.*, C.* FROM categories AS C, categories_description AS CD WHERE CD.language_id=1 AND C.categories_id = CD.categories_id AND C.parent_id=".$cat_id1);

$result = mysql_query("select distinct CD.categories_id, CD.categories_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s, categories AS C, categories_description AS CD, products_to_categories as pc where CD.language_id=1 AND p.products_status = '1' AND C.categories_id = CD.categories_id AND C.parent_id=".$cat_id1." and p.products_id = pc.products_id and pc.categories_id = C.categories_id and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1'");

$chkSub1 = 1;

}

}

else{

//$result = mysql_query("SELECT CD.*, C.* FROM categories AS C, categories_description AS CD WHERE CD.language_id=1 AND C.categories_id = CD.categories_id AND C.parent_id=0");

$result = mysql_query("select distinct CD.categories_id, CD.categories_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s, categories AS C, categories_description AS CD, products_to_categories as pc where CD.language_id=1 AND p.products_status = '1' AND C.categories_id = CD.categories_id AND C.parent_id=0 and p.products_id = pc.products_id and pc.categories_id = C.categories_id and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1'");

}

//print("<br><br>select distinct CD.categories_id, CD.categories_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s, categories AS C, categories_description AS CD, products_to_categories as pc where CD.language_id=1 AND p.products_status = '1' AND C.categories_id = CD.categories_id AND C.parent_id=0 and p.products_id = pc.products_id and pc.categories_id = C.categories_id and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1'");

//$result = mysql_query("SELECT CD.*, C.* FROM categories AS C, categories_description AS CD WHERE CD.language_id=1 AND C.categories_id = CD.categories_id AND C.parent_id=0");

?>

<SELECT NAME="clicklist"style="background-color:#F0F1F4" onChange="location.href=this.form.clicklist.options[this.form.clicklist.selectedIndex

].value">

<?php

if ($chkSub1 == 1){

?>

<OPTION>Sub-categories

<?php

}

else{

?>

<OPTION>Select by category

<?php

}

?>

<option>----------------------

<?php

while($row=mysql_fetch_object($result)) {

print('<option value="specials.php?categories_id='.$row->categories_id.'&inc_subcat=1&manufacturers_id">'.$row->categories_name);

}

//mysql_free_result($result);

?>

<option value="specials.php?categories_id=&inc_subcat=1&manufacturers_id">View All

</SELECT NAME></form>

 

 

-----

Find:

-----

 

<?php

$specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC";

$specials_split = new splitPageResults($specials_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS);

 

if (($specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {

?>

 

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

And replace with:

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

 

<?php

if (isset($categories_id)){

if (empty($categories_id) && $categories_id==""){

$specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC";

}

else{

$specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s, " . TABLE_PRODUCTS_TO_CATEGORIES . " pcat, " . TABLE_CATEGORIES . " cat where p.products_status = '1' and p.products_id = pcat.products_id and pcat.categories_id = cat.categories_id and ((cat.categories_id = " . $categories_id . " or cat.parent_id = " . $categories_id . ")) and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC";

}

}

else{

$specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC";

}

$specials_split = new splitPageResults($specials_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS);

 

if (($specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {

?>

 

 

I can't get this to work on my site either. I have the newest version of Oscommerce. Has anyone been able to get this to work properly?

Link to comment
Share on other sites

  • 4 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...