Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Compare Products Side-By-Side


Recommended Posts

when i noticed that this nice contrib looked as it should work together with the "Productslisting in cols" i DL it again, to test it out?

But when doing a compare on three of my products i end up with this SQL error :(

1064 - You have an error in your SQL syntax near 'using (products_id) left join manufacturers m using (' at line 1

select p.products_image, pd.products_description, pd.products_name, m.manufacturers_name, p.products_model, p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, 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 join products p using (products_id) left join manufacturers m using (manufacturers_id) left join specials s on p.products_id = s.products_id where p.products_id in (889,540,394) and pd.language_id = '4' order by p.products_id asc

Anyone that got a clue to what exactly is going down the drain here? :blink: :blush:

----===~~oOo~~===----

// Bjarne Varoystrand aka Black Skorpio

Do to others what you want them to do to you

- �� Lek och Lust F�r Vuxna

Link to comment
Share on other sites

your version of mysql might not like the using construction,

you can change it to

 

on pd.products_id = p.products_id

 

and the next one

 

on p.manufacturers_id = m.manufacturers_id

 

Hope that's it - otherwise I'll have to go read the manuals :D

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

I am ussually pretty good a figuring stuff out..not today...but how do you install the contributions, particularly this one.

 

I would of thought there to be a readme to accmpany the php file, but no luck.

 

Any help would be great.

 

pony boy

 

 

This contribution offers a side-by-side comparison feature from the product_listing page

 

Purpose: Contribution to osCommerce for shop owners that want to offer online dynamic database driven side-by-side product comparison feature to their customers.

 

Features:

        - language support

        - currency support

        - special price displayed if available

        - Clicking on product name and image brings up product_info page

 

Supported/compatible with following contributions:

        - option_types_feature v1.6 contribution

        - static attributes contribution

 

Parameters:

Note: all parameters follow the following naming convention: COMPARE_PRODUCTS_SIDEBYSIDE_XXX and are set via the admin configuration interface

- DEBUG: if set to true; shows some debug info on top of the page

- NAME: if set to true shows in the header

- IMAGE: if set to true shows in the header

- PRICE: if set to true shows in the header

- MODEL: if set to true shows in the data body

- MANUFACTURER: if set to true shows in the data body

- DESCRIPTION: if set to true shows in the data body

- QUANTITY: if set to true shows in the data body

- WEIGHT: if set to true shows in the data body

- STATIC: if set to true shows all static attributes in the data body

- OPTIONS: if set to true shows all available options in the data body

- COLUMN_LEFT: if set to true shows standard left column

- COLUMN_RIGHT: if set to true shows standard right column

- FOOTER: if set to true shows standard footer

- BUY_NOW: Not yet implemented

Demo

Link to comment
Share on other sites

Check the complete zip from 25-OCT-2004.

It contains detailed installation instructions.

The more recent additions are

1) an example of a column listing with the necessary changes applied

2) an updated compare.php page to show prices with the options.

 

HTH

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

  • 1 month later...

I need help with something simple now.

 

1) The comparisons are vertically centered...I want them at the top of the page.

 

2) The product description is also vertically centered and I want it at the top of the cell.

 

I figure out the left/right/justify...but how do I change the vertical alignment (valign)?

Link to comment
Share on other sites

For 1) add valign=t"top" to the <td> on line 448 (the main body <td> tag)

 

For 2) to get the vertical alignment on top, you need to add valign to the cells you want top aligned like this (description section), just add it in the params section after class, or change the css class itself if you want this behaviour for all cells:

    if (COMPARE_PRODUCTS_SIDEBYSIDE_DESCRIPTION == 'true') {
       $cur_row++;
       $list_box_contents[$cur_row][] = array('align' => $lc_align,
                                       'params' => 'class="compareListing-data" valign="top"',
                                       'text' => TABLE_HEADING_DESCRIPTION);
       for ($k = 0; $k < count($columns); $k++) {
           $list_box_contents[$cur_row][] = array('align' => $lc_align,
                                       'params' => 'class="compareListing-data" valign="top"',
                                       'text' => ' ' . $pd[$columns[$k]]['products_description'] . ' ');
       }
   }

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

Hi,

 

I'm an newbie. I wanna use "compare .." contribute but don't know which latest file for installation ? I found much files for update !

 

Thanks

 

[ XzZzX ]

~ @ Everything in your Hands @ ~

Link to comment
Share on other sites

well if you had read 5 posts back you'd seen the answer :)

http://www.oscommerce.com/forums/index.php?sho...619132&st=120

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

hi,

how can i use this contribution?

See previous posts link for what to download and install.

Please be more specific if you have any questions on how to do this ...

 

and is there a contribution for showing categories with their imgaes on the index page?

I think there is one and is called 'categories on main page'

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

Been looking and pooking with it a bit on the demo site and looks very good, and if it works... Well... Thats about all that matters, not how the coding is. ;)

1 thing I wonder about though.

Can't you "crosscompare"? That is you only seem to be able to compare products that are in the same cattegory?

 

For instanse if I take the demosite as an example.

Let say I want to buy a dryer...

Then Im only able to compare the ones that are in the:

AEG : http://www.keukenlust.com/index.php?manufacturers_id=20

But what if I also want the ones in the :

Zanussi : http://www.keukenlust.com/index.php?manufacturers_id=40

at the same time?

 

Do you understand what I mean?!

 

Im planning to give people the option to compare dogfood.

So there are about +50 different brands and each brand have about 10 different kinds of dogfood.

So is it possible to fix so you can "tag" 1 thing in a cattegorie and then switch cattegory and "tag" the ones you want in the same "compare" list.

 

phuew.... Did you understand what I meant (I barely did! :rolleyes: )?!

Link to comment
Share on other sites

I fully understand what you mean, that is exactly the design limitation I was alluding to ...

I requires a re-design to have some kind of comparison cart ...

 

Sorry, I won't be able to do that in the next few weeks, I have other priorities right now (like integrating an auction system and providing faceted search ...)

 

Maybe someone else would like this too and step up to the challenge :)

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

Ahhh.... kk.... Thats what you meant.

Well... Then you have something to do on a future "rainy day" and is also struck by a bolt of insperation. In the meantime I have to find a solution to work around it.

I for one would be really gratefull when that rainy day comes though. ;)

 

One of these days I have to sit down myself and fiddeling around with php and start to learn it. Just beeing more and more sucked into that world due to phpBB, MX-portal and now OsCom. ;)

Link to comment
Share on other sites

  • 2 months later...
your version of mysql might not like the using construction,

you can change it to

 

on pd.products_id = p.products_id

 

and the next one

 

on p.manufacturers_id = m.manufacturers_id

 

Hope that's it - otherwise I'll have to go read the manuals :D

 

I was receiving the same error and found that it was not the using construction but that the first or "plain" join command needed to be prefaced with the inner verb.

 

change this:

 

select p.products_image, pd.products_description, pd.products_name, m.manufacturers_name, p.products_model, p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, 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 join products p using....

 

To:

 

select p.products_image, pd.products_description, pd.products_name, m.manufacturers_name, p.products_model, p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, 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 inner join products p using

 

do this for every instance where there is a plain "join".

 

I am running MySQL Version 3.23.58 Running with PHP Version 4.3.2 and this seemed to remove the error that was in the previous post.

 

Hope this helps.

Link to comment
Share on other sites

 

 

I applied the contrib and its exactly what i need. However when I drill down to a product and click on 'add to cart' i goto the cart view, but the product is not added to my cart.

 

My syntax looks proper, has anyone had this before or have i just made a mistake?

 

any help is appreciated :D

 

Pauly.

Link to comment
Share on other sites

I applied the contrib and its exactly what i need. However when I drill down to a product and click on 'add to cart' i goto the cart view, but the product is not added to my cart.

 

My syntax looks proper, has anyone had this before or have i just made a mistake?

 

any help is appreciated :D

 

Pauly.

I don't know of this kind of problem.

could you post your product_listing.php file for us ?

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

hello, I need to use two contributions, the contribution "Product Listing view change" of Norio Itabashi with the contribution "Compares Products Side-By-Side". simply it is necessary to apply the changes of compares, to product_listing.php of product listing. It sounds easy but I not to become it, and but I am going to have to choose not to use one of the two contributions and to the truth it is that she is one hurts because the two are very good.

 

sorry for my english...

Link to comment
Share on other sites

hello, I need to use two contributions, the contribution "Product Listing view change" of Norio Itabashi with the contribution "Compares Products Side-By-Side".  simply it is necessary to apply the changes of compares, to product_listing.php of product listing.  It sounds easy but I not to become it, and but I am going to have to choose not to use one of the two contributions and to the truth it is that she is one hurts because the two are very good.

 

sorry for my english...

and I thought I new every product listing module :blush:

 

I'll need to have a closer look to see if it's easy to incorporate.

I'll post back when I have something ready to test, though I can't make any promise on timeframe.

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

this is de code to the "Product Listing view change" of Norio Itabashi contribution.

 

<?php
/*
 $Id: product_listing.php,v 1.1.1.1 2003/02/20 01:03:54 ptosh Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
?>
<?php
     // VIEW_OPSION SESSION REGISTER
     switch($HTTP_GET_VARS['listing']){
       case 'vertical' :
       $view = 'vertical';
       break;
       
       case 'side' :
       $view = 'side';
       break;
       
     }
     tep_session_register('view');
     ?>


<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <form>
   <tr>
     <td class="main"><b><?php echo LISTING_DISPLAY_OPTION; ?></b>
     <select size="1" onChange="if(options[selectedIndex].value) window.location.href=(options[selectedIndex].value)">
       <option <?php if($view=='vertical'){ echo 'selected';} ?> value="<?php echo tep_href_link(basename($PHP_SELF),tep_get_all_get_params(array('listing')).'listing=vertical', NONSSL);?>"><?php echo SORT_BY_IMAGE_TEXT; ?></option>
       <option <?php if($view=='side'){ echo 'selected';} ?> value="<?php echo tep_href_link(basename($PHP_SELF),tep_get_all_get_params(array('listing')).'listing=side', NONSSL);?>"><?php echo SORT_BY_IMAGE; ?></option>
     </select></td>
     <td align="right" class="main"><b><?php echo LISTING_SORT_BY; ?></b>      <select name="select" onChange="if(options[selectedIndex].value) window.location.href=(options[selectedIndex].value)">
       <option value="<?php echo tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('page', 'info', 'sort')) . 'page=1&sort=5a'); ?>"  <?php if($HTTP_GET_VARS['sort'] == '5a') {echo 'SELECTED';}else{ echo '';} ?>><?php echo LISTING_PRICE_LOW; ?></option>
       <option value="<?php echo tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('page', 'info', 'sort')) . 'page=1&sort=5d'); ?>"  <?php if($HTTP_GET_VARS['sort'] == '5d') {echo 'SELECTED';}else{ echo '';} ?>><?php echo LISTING_PRICE_HIGHT; ?></option>
       <option value="<?php echo tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('page', 'info', 'sort')) . 'page=1&sort=3d'); ?>"  <?php if($HTTP_GET_VARS['sort'] == '3d') {echo 'SELECTED';}else{ echo '';} ?>><?php echo LISTING_TITLE_A_TO_Z; ?></option>
       <option value="<?php echo tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('page', 'info', 'sort')) . 'page=1&sort=3a'); ?>"  <?php if($HTTP_GET_VARS['sort'] == '3a') {echo 'SELECTED';}else{ echo '';} ?>><?php echo LISTING_TITLE_Z_TO_A; ?></option>
       </select></td>
   </tr>
 </form>
</table><br>

<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <?php
 $listing_numrows_sql = $listing_sql;
 //$listing_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $listing_sql, $listing_numrows);
 $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS,  'p.products_id', $HTTP_GET_VARS['page'], $listing_numrows);
// fix counted products
 $listing_numrows = tep_db_query($listing_numrows_sql);
 $listing_numrows = tep_db_num_rows($listing_numrows);

 if ( ($listing_numrows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {
?>
 <tr>
   <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
     <tr>
       <td class="smallText">  </td>
       <td align="right" class="smallText"> <?php echo TEXT_RESULT_PAGE; ?> <?php echo $listing_split->display_links($listing_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?> </td>
     </tr>
   </table></td>
 </tr>
 <tr>
   <td><?php echo tep_draw_separator(); ?></td>
 </tr>
 <?php
 }
?>
 <tr>
   <td><?php
if ($listing_numrows > 0) {

switch($view){
############################
#      Image + Text        #
############################
case 'vertical':
   $listing_query = tep_db_query($listing_sql);
echo '<table border="0" width="100%" cellspacing="0" cellpadding="2">'."\n";
while ($listing = tep_db_fetch_array($listing_query)) {
//price
       if (tep_not_null($listing['specials_new_products_price'])) {
           $price = '<s>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>  <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span> ';
            } else {
           $price = $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ';
       }
  //buynow
   if($listing['products_quantity'] > 0) {
       $BUY_NOW = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', TEXT_BUY . $listing['products_name'] . TEXT_NOW) . '</a> ';
          } else {
      $BUY_NOW = STOCK_MARK_PRODUCT_OUT_OF_STOCK;
   }
  //stylesheet.css
  if (($row/2) == floor($row/2)) {
       $_class = "productListing-even";
     } else {
       $_class = "productListing-odd";
     }
  
  $row++;
       echo '<tr class="'.$_class.'">';
    echo '<td align="center" class="productListing-data"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>';
       echo '<td align="center" class="productListing-data"> '.$listing['products_model'].' </td>';
       echo '<td class="productListing-data"> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">'.$listing['products_name'].'</a> </td>';
    echo '<td align="right" class="productListing-data"> '.$price.' </td>';
       echo '<td align="right" class="productListing-data">'.$BUY_NOW.' </td>';
    echo '</tr>';
}
echo '</table>';
 break;
############################
#      Image               #
############################
case 'side':
default:
   $listing_query = tep_db_query($listing_sql);
echo '<table border="0" width="100%" cellspacing="0" cellpadding="2">'."\n";
 echo   '<tr>'."\n";
     $row = 0;
  $col = 0;

while ($listing = tep_db_fetch_array($listing_query)) {
//price
       if (tep_not_null($listing['specials_new_products_price'])) {
           $price = '<s>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>  <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span> ';
            } else {
           $price = $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ';
       }
  //buynow
   if($listing['products_quantity'] > 0) {
       $BUY_NOW = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', TEXT_BUY . $listing['products_name'] . TEXT_NOW) . '</a> ';
          } else {
      $BUY_NOW = STOCK_MARK_PRODUCT_OUT_OF_STOCK;
   }

     $row++;
  $col++;
    echo '<td align="center" class="productListing-data" width="33%" valign="top" style="padding-bottom:10px;"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br>'.$listing['products_name'].'</a><br>'.$price./*'<br>'.$BUY_NOW.*/'</td>';
                  if ($col > 2) {
                  echo '</tr>'."\n".'<tr>'."\n";
                     $col = 0;
                     $row ++;
                  }
}
   echo '</tr>';
echo '</table>';
break;
} 

 //  new tableBox($list_box_contents, true);

   echo '    </td>' . "\n" .
        '  </tr>' . "\n";
 } else {
?>
   <tr class="productListing-odd">
   <td class="smallText"> <?php echo (isset($HTTP_GET_VARS['manufacturers_id']) ? TEXT_NO_PRODUCTS : TEXT_NO_PRODUCTS); ?> </td>
 </tr>
 <?php
 }
?>
 <tr>
   <td><table width="100%" height="2" cellspacing="0" cellpadding="0" border="0" bgcolor="#CCCCCC"><tr><td><img src="images/pixel_trans.gif" height="2" width="100%"></td></tr></table></td>
 </tr>
 <?php
 if ( ($listing_numrows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
?>
 <tr>
   <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
     <tr>
       <td class="smallText">  </td>
       <td align="right" class="smallText"> <?php echo TEXT_RESULT_PAGE; ?> <?php echo $listing_split->display_links($listing_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?> </td>
     </tr>
   </table></td>
 </tr>
 <?php
 }
?>
</table>

Link to comment
Share on other sites

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