Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Display default Size and Color in product Listing Oscommerce CE


radhavallabh

Recommended Posts

Hi,
I am trying to locate a module to Display default Size and Color in product Listing, I am using the frozen Bootstrap 3 Oscommerce CE version currently.

But am not able to find it on the app section may be some other name is used for it..

Any help on this would be deeply appreciated. I really think that this feature would be a great help to improve the oscommerce interface against our competitors..

Thank you very much in advance; Really grateful to all awesome osccommerce developers to bring our software so far!!!! Big Cheers to their hard work.

Warm Regds./😊

radhavallabh

Link to comment
Share on other sites

It's old and will need to be updated and perhaps re coded but it will show you what's required.

https://apps.oscommerce.com/Vj2cl&product-listing-with-attributes

However the simplest way to do this is to include the default color/size in your product discription!

image.png.e172f986ab8f65926fa72081f841a7b7.png 

 

Radiant Tee, color-orange, size 12

(other colors and size available)

So light and comfy, you'll love the Radiant Tee's organic fabric, feel, performance and style. You may never want to stop moving in this shirt.

• Salmon soft scoop neck tee.
• Athletic, semi-form fit.
• Flat seams prevent chafing.
• 67% Organic Cotton / 28% Hemp / 5% Spandex.

 

 

Link to comment
Share on other sites

22 minutes ago, Tsimi said:

 

30 minutes ago, JcMagpie said:

It's old and will need to be updated and perhaps re coded but it will show you what's required.

https://apps.oscommerce.com/Vj2cl&product-listing-with-attributes

However the simplest way to do this is to include the default color/size in your product discription!

image.png.e172f986ab8f65926fa72081f841a7b7.png 

 

Radiant Tee, color-orange, size 12

(other colors and size available)

So light and comfy, you'll love the Radiant Tee's organic fabric, feel, performance and style. You may never want to stop moving in this shirt.

• Salmon soft scoop neck tee.
• Athletic, semi-form fit.
• Flat seams prevent chafing.
• 67% Organic Cotton / 28% Hemp / 5% Spandex.

 

Thank you so much for the awesome inputs..

To be more precise I have products that start with different default sizes so the pricing varies accordingly.

On the product listing page It thus ends up showing the customer that price is really high for the product with bigger default size.

I really like the idea to add the drop downs to the listing page but that will make it very heavy,

So what I thought of was of just displaying the text of the Default size with a + more and Default color with + more

and i just want to add a particular attribute of size and color only to the listings.

@JcMagpie I do have all the details of default size and color and description but I want the customers to see the the default size in text format on the Listing, so could understand why price varies.

@Tsimi Lovely creation I like it so much- is it possible to just fetch particular type of attribute and display it as text only not all the dropdown options dear?

Awaiting your awesome inputs,

Thank you again for being of such great help;

Warm Regds./

radhavallabh

Link to comment
Share on other sites

Just droping attributes into listings is not I think the best solution! If you wish to do this   properly then the product listing needs to be re designed, somthing like this, so you can show the lowest price and all the options directly, the dropdowns are not good for customers! the info should just be visable ready for selection by customer.

Post in the comercial section I would be amazed if one of the developers has not allready done this for osC.

image.png.21a1abe483d108740ccc4dc8bf2f90a2.png

 

Link to comment
Share on other sites

@JcMagpie Wow superb idea.. This looks so cool sure will ask for quotes!

How about just displaying the default attribute as swatch or text icon... and for more of them the customer should click on the item.. This will put less load on the listing page.

I find that way to be speedy and better....

Link to comment
Share on other sites

Sure you can do that I had a look some time ago, but again you need to edit core files but it's a quick hack, needs to be done more elegantly and probably by a professional developer and not me ! 😊 hacking will only get you so far... The main problem is that attributes have never been easy or elagent in osC you will find a number of add-on that try to make them more user friendly. As I said it's best done as a full redesign as a add-on or alternative core files. Also if you allow selection of option on grid list you will need to make sure price is updated also!

image.png.09fac486dbe05baf6bf9d59250dd2828.png

 

Link to comment
Share on other sites

5 minutes ago, JcMagpie said:

Sure you can do that I had a look some time ago, but again you need to edit core files but it's a quick hack, needs to be done more elegantly and probably by a professional developer and not me ! 😊 hacking will only get you so far... The main problem is that attributes have never been easy or elagent in osC you will find a number of add-on that try to make them more user friendly. As I said it's best done as a full redesign as a add-on or alternative core files. Also if you allow selection of option on grid list you will need to make sure price is updated also!

image.png.09fac486dbe05baf6bf9d59250dd2828.png

Great idea.. For ripping of the complete load of adding values how about no selection at all...just the default Size and default Color swatch..

Example-

Default Size: 4 inch + More
Color: Yellow +More

Then customer will click on the product for More options...

How will that be?...

 

Link to comment
Share on other sites

Sure just comment out the select boxs in the code! if your hacking you can do whatever you wish. Many ways you could add this aditional info to product listings, Have a look at my product info tabs, it is doing something like this as it pulls aditional info simply from files to display, you could do something like that for the products you need this on.

I would first as the developers to see if they have something ready to use! would be much easier and safer than hacking core files. 😊

 

Link to comment
Share on other sites

3 minutes ago, JcMagpie said:

Sure just comment out the select boxs in the code! if your hacking you can do whatever you wish. Many ways you could add this aditional info to product listings, Have a look at my product info tabs, it is doing something like this as it pulls aditional info simply from files to display, you could do something like that for the products you need this on.

I would first as the developers to see if they have something ready to use! would be much easier and safer than hacking core files. 😊

Thank you for the hint dear.. Will start working on it right away!😉:thumbsup:

Link to comment
Share on other sites

1 hour ago, JcMagpie said:

Sure just comment out the select boxs in the code! if your hacking you can do whatever you wish. Many ways you could add this aditional info to product listings, Have a look at my product info tabs, it is doing something like this as it pulls aditional info simply from files to display, you could do something like that for the products you need this on.

I would first as the developers to see if they have something ready to use! would be much easier and safer than hacking core files. 😊

Can you hint me on altering the code to just pulling just the product option default value (without price and weight) without pulling the whole array of it.

It would be of great help dear!

Link to comment
Share on other sites

No sorry , pulling from the existing attributes is not going to be easy just take a look at the db and you will understand why, You have nothing in the db to define which is the  default value!

If I remember corectly it's simply sorts by order they are entered or you can edit code to sort by value but nothing to say what is default! As I said best to talk to one of the developers.

image.png.c38c2c14cf902074d0f53a0e169c7fe6.png

 

Link to comment
Share on other sites

7 minutes ago, JcMagpie said:

No sorry , pulling from the existing attributes is not going to be easy just take a look at the db and you will understand why, You have nothing in the db to define which is the  default value!

If I remember corectly it's simply sorts by order they are entered or you can edit code to sort by value but nothing to say what is default! As I said best to talk to one of the developers.

image.png.c38c2c14cf902074d0f53a0e169c7fe6.png

I understand.. Ok will ping them..Thank you again!

Warm Regds,/

radhavallabh😊

Link to comment
Share on other sites

This is only for information and NOT a working solution! Simply using existing code for product weight or any other section as a way of adding more information to product listings.

In products-listing.php around line 201 in CE BS4,

make the fllowing changes, It's a simple approach ( a bit like me :) ) make a foulder moreinfo and in it place a html  file called model_number_INFO.html.

Place Into this using simple html place any info you wish to display. Then for any product that has a file the info will be displayed on product listing.

  if (PRODUCT_LIST_WEIGHT > 0) {
      $extra_list_contents .= '<dt>' . TABLE_HEADING_WEIGHT . '</dt>';
      $extra_list_contents .= '<dd>' . $listing['products_weight'] . '</dd>';
      $filenameY1 = $_SERVER['DOCUMENT_ROOT'] . '/moreinfo/'.$listing['products_model'].'_INFO.html';
      $html = file_get_contents($filenameY1);
      $extra_list_contents .= '<dd>' . $html . '</dd>';

You can see it working on the test site under these products. You can see only one product shows the listing. This is simply a example it needs a lot more work to make it a working solution. That's down to you.

https://chilleddisplays.co.uk/index.php/cPath/25

 

image.png.48c9dc846daacb31d664041d50a5279f.png

 

Link to comment
Share on other sites

If you feel like doing a bit more then this is a nice bit of code you can use to make a responsise product builder, allows color selection , spec changes and anything else you can think of. It's free to use under MIT license

https://codyhouse.co/gem/product-builder

demo https://codyhouse.co/demo/product-builder/index.html

 

Link to comment
Share on other sites

14 hours ago, JcMagpie said:

This is only for information and NOT a working solution! Simply using existing code for product weight or any other section as a way of adding more information to product listings.

In products-listing.php around line 201 in CE BS4,

make the fllowing changes, It's a simple approach ( a bit like me :) ) make a foulder moreinfo and in it place a html  file called model_number_INFO.html.

Place Into this using simple html place any info you wish to display. Then for any product that has a file the info will be displayed on product listing.


  if (PRODUCT_LIST_WEIGHT > 0) {
      $extra_list_contents .= '<dt>' . TABLE_HEADING_WEIGHT . '</dt>';
      $extra_list_contents .= '<dd>' . $listing['products_weight'] . '</dd>';
      $filenameY1 = $_SERVER['DOCUMENT_ROOT'] . '/moreinfo/'.$listing['products_model'].'_INFO.html';
      $html = file_get_contents($filenameY1);
      $extra_list_contents .= '<dd>' . $html . '</dd>';

You can see it working on the test site under these products. You can see only one product shows the listing. This is simply a example it needs a lot more work to make it a working solution. That's down to you.

https://chilleddisplays.co.uk/index.php/cPath/25

 

image.png.48c9dc846daacb31d664041d50a5279f.png

Wow thanks a ton!! This will help me move in a great positive direction...

13 hours ago, JcMagpie said:

If you feel like doing a bit more then this is a nice bit of code you can use to make a responsise product builder, allows color selection , spec changes and anything else you can think of. It's free to use under MIT license

https://codyhouse.co/gem/product-builder

demo https://codyhouse.co/demo/product-builder/index.html

Awesome idea!!! Super excited getting to work on them right away!!

:thumbsup:Thank you so much once again for being so helpful in guiding me...

Very Warm Regds./

radhavallabh

Link to comment
Share on other sites

Had a little play with this to see what could be done with existing code? Shamelessly using and abusing existing code posted here on the forum and other places so I take no credit for this.

Not a real elegant solution but you can do some basic stuff with existing attributes. Fair warning this is making core code changes.

We can do 2 things, first simply display the attributes in the listings. Simply informing the customer what options are available. They can then go to product info page and see details.

image.png.06567ed0a67d2ca23f34294884e914b2.png

Or we can display the attributes and allow selection in the listing to add to cart! (Not tested so be carefull). As you can see got rid of the drop down so customer can see all options and simply select which is required.

image.png.c8134eb60effc696773ceb866aa16bd6.png

To make this work properly as requested with default products we will need to change how we use attributes. We will need to add the stock product to the attributes at zero cost. So say the white tee shirt in size Large is your default product, both white and Large are added to attributes at zero cost. We the order the attributes by cost so that the default is displayed first in the options. That's about as much as we can do with the current code.

ok so here are the core code edit's these are for CE BS3 Frozen only

For no radio button shown
In public_html/includes/functions/html_output.php
add this to end of file after last } and before ?> if it exists.

// Output a form radio menu for product info page
  function tep_draw_radio_menu($name, $values, $default = '', $parameters = '', $required = false) {
	$field ='';   
	if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]);

    for ($i=0, $n=sizeof($values); $i<$n; $i++) {
	  $value = tep_output_string($values[$i]['id']);
      //$field .= '<input type="radio" name="' . $name . '" value="' . $value . '"';
        //$field .= ' ';

      $field .= '' . tep_output_string($values[$i]['text'], array('"' => '&quot;', '\'' => '&#039;', '<' => '&lt;', '>' => '&gt;')) . '&nbsp;';
    }
    $field .= '';

    if ($required == true) $field .= TEXT_FIELD_REQUIRED;

    return $field; 
  } 

if you do wish to show the radio buttons use this

In public_html/includes/functions/html_output.php
add this to end of file after last } and before ?> if it exists.

// Output a form radio menu for product info page
  function tep_draw_radio_menu($name, $values, $default = '', $parameters = '', $required = false) {
	$field ='';   
	if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]);

    for ($i=0, $n=sizeof($values); $i<$n; $i++) {
	  $value = tep_output_string($values[$i]['id']);
      $field .= '<input type="radio" name="' . $name . '" value="' . $value . '"';
        $field .= ' ';

      $field .= '>' . tep_output_string($values[$i]['text'], array('"' => '&quot;', '\'' => '&#039;', '<' => '&lt;', '>' => '&gt;')) . '&nbsp;';
    }
    $field .= '';

    if ($required == true) $field .= TEXT_FIELD_REQUIRED;

    return $field; 
  }       

 

Ok now to get the attributes into product_listings

In public_html/includes/modules/product_listing.php

find

if (tep_not_null($extra_list_contents)) {
       $prod_list_contents .= '    <dl class="dl-horizontal list-group-item-text">';
       $prod_list_contents .=  $extra_list_contents;
       $prod_list_contents .= '    </dl>';
    }

and after add this,

// add the atributes to listing starts here
            $prod_list_contents .= '<form name="buy_now_' . $listing['products_id'] . '" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now_form', 'NONSSL') . '">';

            $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . $listing['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "'"); 
            $product_info = tep_db_fetch_array($product_info_query); 
            $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'"); 
            $products_attributes = tep_db_fetch_array($products_attributes_query); 
			
	if ($products_attributes['total'] > 0) { 
            $prod_list_contents .= '<div class="clearfix"></div>'; 
			
        $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'"); 
		while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { 

            $products_options_array = array(); 
            $prod_list_contents .= '<label>' . $products_options_name['products_options_name'] . ':</label><br />'; 
            
			$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . $listing['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'"); 
			while ($products_options = tep_db_fetch_array($products_options_query)) { 
              $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']); 
				if ($products_options['options_values_price'] != '0') { 
				  $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; 
				} 
			} 
          //$prod_list_contents .= tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $cart->contents[$_GET['products_id']]['attributes'][$products_options_name['products_options_id']], 'style="width: 250px;"'). '<br />'; 
            
        $prod_list_contents .= tep_draw_radio_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $cart->contents[$_GET['products_id']]['attributes'][$products_options_name['products_options_id']], 'style="width: 250px;"'). '<br />'; 
          

		} 
    }

	  $prod_list_contents .= '<div class="text-right">';
	  $prod_list_contents .= '<label>Quantity</label>&nbsp;' . tep_draw_input_field('cart_quantity', 1, 'style="width:70px;text-align:center;"');
	  $prod_list_contents .= '</div>'; 
// arributes listing ends here	

 

If you wish to show stock attribute in list in first position then you will need to add it to atributes at zero cost and sort by price. To do this

in /public_html/includes/modules/content/product_info/cm_pi_options_attributes.php

Find

$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from products_attributes pa, products_options_values pov where pa.products_id = '" . (int)$_GET['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");

and change to or replace with this,

$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from products_attributes pa, products_options_values pov where pa.products_id = '" . (int)$_GET['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'" . 'ORDER BY pa.options_values_price');
 

 

It can be seen running in display only mode on the test site https://www.justfastfood.com/hardware-graphics-cards-c-1_23.html

Please note this is just to show what can be done and is NOT beeing recomended as a working solution.  As allways backup before you make any changes. Also this was tested on stock CE BS3 only, I have not idea how it will behave on modified code so you need to do your own testing before using on live site.

 

 

Link to comment
Share on other sites

35 minutes ago, JcMagpie said:

Had a little play with this to see what could be done with existing code? Shamelessly using and abusing existing code posted here on the forum and other places so I take no credit for this.

Not a real elegant solution but you can do some basic stuff with existing attributes. Fair warning this is making core code changes.

We can do 2 things, first simply display the attributes in the listings. Simply informing the customer what options are available. They can then go to product info page and see details.

image.png.06567ed0a67d2ca23f34294884e914b2.png

Or we can display the attributes and allow selection in the listing to add to cart! (Not tested so be carefull). As you can see got rid of the drop down so customer can see all options and simply select which is required.

image.png.c8134eb60effc696773ceb866aa16bd6.png

To make this work properly as requested with default products we will need to change how we use attributes. We will need to add the stock product to the attributes at zero cost. So say the white tee shirt in size Large is your default product, both white and Large are added to attributes at zero cost. We the order the attributes by cost so that the default is displayed first in the options. That's about as much as we can do with the current code.

ok so here are the core code edit's these are for CE BS3 Frozen only

For no radio button shown
In public_html/includes/functions/html_output.php
add this to end of file after last } and before ?> if it exists.


// Output a form radio menu for product info page
  function tep_draw_radio_menu($name, $values, $default = '', $parameters = '', $required = false) {
	$field ='';   
	if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]);

    for ($i=0, $n=sizeof($values); $i<$n; $i++) {
	  $value = tep_output_string($values[$i]['id']);
      //$field .= '<input type="radio" name="' . $name . '" value="' . $value . '"';
        //$field .= ' ';

      $field .= '' . tep_output_string($values[$i]['text'], array('"' => '&quot;', '\'' => '&#039;', '<' => '&lt;', '>' => '&gt;')) . '&nbsp;';
    }
    $field .= '';

    if ($required == true) $field .= TEXT_FIELD_REQUIRED;

    return $field; 
  } 

if you do wish to show the radio buttons use this

In public_html/includes/functions/html_output.php
add this to end of file after last } and before ?> if it exists.


// Output a form radio menu for product info page
  function tep_draw_radio_menu($name, $values, $default = '', $parameters = '', $required = false) {
	$field ='';   
	if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]);

    for ($i=0, $n=sizeof($values); $i<$n; $i++) {
	  $value = tep_output_string($values[$i]['id']);
      $field .= '<input type="radio" name="' . $name . '" value="' . $value . '"';
        $field .= ' ';

      $field .= '>' . tep_output_string($values[$i]['text'], array('"' => '&quot;', '\'' => '&#039;', '<' => '&lt;', '>' => '&gt;')) . '&nbsp;';
    }
    $field .= '';

    if ($required == true) $field .= TEXT_FIELD_REQUIRED;

    return $field; 
  }       

 

Ok now to get the attributes into product_listings

In public_html/includes/modules/product_listing.php

find


if (tep_not_null($extra_list_contents)) {
       $prod_list_contents .= '    <dl class="dl-horizontal list-group-item-text">';
       $prod_list_contents .=  $extra_list_contents;
       $prod_list_contents .= '    </dl>';
    }

and after add this,


// add the atributes to listing starts here
            $prod_list_contents .= '<form name="buy_now_' . $listing['products_id'] . '" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now_form', 'NONSSL') . '">';

            $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . $listing['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "'"); 
            $product_info = tep_db_fetch_array($product_info_query); 
            $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'"); 
            $products_attributes = tep_db_fetch_array($products_attributes_query); 
			
	if ($products_attributes['total'] > 0) { 
            $prod_list_contents .= '<div class="clearfix"></div>'; 
			
        $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'"); 
		while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { 

            $products_options_array = array(); 
            $prod_list_contents .= '<label>' . $products_options_name['products_options_name'] . ':</label><br />'; 
            
			$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . $listing['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'"); 
			while ($products_options = tep_db_fetch_array($products_options_query)) { 
              $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']); 
				if ($products_options['options_values_price'] != '0') { 
				  $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; 
				} 
			} 
          //$prod_list_contents .= tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $cart->contents[$_GET['products_id']]['attributes'][$products_options_name['products_options_id']], 'style="width: 250px;"'). '<br />'; 
            
        $prod_list_contents .= tep_draw_radio_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $cart->contents[$_GET['products_id']]['attributes'][$products_options_name['products_options_id']], 'style="width: 250px;"'). '<br />'; 
          

		} 
    }

	  $prod_list_contents .= '<div class="text-right">';
	  $prod_list_contents .= '<label>Quantity</label>&nbsp;' . tep_draw_input_field('cart_quantity', 1, 'style="width:70px;text-align:center;"');
	  $prod_list_contents .= '</div>'; 
// arributes listing ends here	

 

If you wish to show stock attribute in list in first position then you will need to add it to atributes at zero cost and sort by price. To do this

in /public_html/includes/modules/content/product_info/cm_pi_options_attributes.php

Find


$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from products_attributes pa, products_options_values pov where pa.products_id = '" . (int)$_GET['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");

and change to or replace with this,


$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from products_attributes pa, products_options_values pov where pa.products_id = '" . (int)$_GET['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'" . 'ORDER BY pa.options_values_price');
 

 

It can be seen running in display only mode on the test site https://www.justfastfood.com/hardware-graphics-cards-c-1_23.html

Please note this is just to show what can be done and is NOT beeing recomended as a working solution.  As allways backup before you make any changes. Also this was tested on stock CE BS3 only, I have not idea how it will behave on modified code so you need to do your own testing before using on live site.

 

Looks super!!!🤩

Exactly what I need.. Just one more hack can we just show selective product options using their particular id??

Like Only Memory not Model as on your link?? I want to display only one type of Product Option on all products if it exists? So Memory shall display if it exists otherwise no attribute display... Is it possible??? Would be great

You just rock dear!!! Awesome  indeed!!! This is so amazing ... Thank you for being such a great guide and help,

Very Warm Regds./

radhavallabh

Link to comment
Share on other sites

2 hours ago, radhavallabh said:

Exactly what I need.

and then you say can we!!!! 🙄

Sorry no idea what you are trying to do! The attributes are an array and we simply fetch the array and display if it exsits on a product! so if a product has no attributes then nothing will show! If it only has one then only one will show.

If a product has 2 and you only wish to show only one then simply remove the other attribute.

 

Link to comment
Share on other sites

Touch the option need to change lot of thing inside Osc. It's not just a cosmetic. The impact is in on the shopping cart class (add, update, delete, recover...), confirmation, process, order and all payment like paypal including the session.
In all cases, if you change the system in the options (products_info), you must update all the code. 
You must understand, it's not a simple work and take lot of time and the repercussion inside all Osc is very important.

Select is one selection ==> ok work
Radio field is one  ===> ok work
Checkbox is many selection ===> not work
Select multiple  is many selection ===> not work

There is no add on works with the last 2 options above, just partial with some error inside, not recommended to install.

 

 

 


Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

 

Link to comment
Share on other sites

14 hours ago, JcMagpie said:

and then you say can we!!!! 🙄

Sorry no idea what you are trying to do! The attributes are an array and we simply fetch the array and display if it exsits on a product! so if a product has no attributes then nothing will show! If it only has one then only one will show.

If a product has 2 and you only wish to show only one then simply remove the other attribute.

Hi, Sorry to be blunt.. I shall explain further.

I have almost 6 attributes to each product..So difficult to show all on listing page.

All my products vary in price because of Size option mainly. 

Hence I asked to show just one attribute ..example- the Size on the product listing..

I was using the text type option you gave..no radio buttons to it.But showing all attributes is making each listing very long..Hence want to just display default Size👍

Sorry again..Hope you understand my point now..

Thank you so much again..

Warm Regds..

Radhavallabh 

Link to comment
Share on other sites

14 hours ago, Gyakutsuki said:

Touch the option need to change lot of thing inside Osc. It's not just a cosmetic. The impact is in on the shopping cart class (add, update, delete, recover...), confirmation, process, order and all payment like paypal including the session.
In all cases, if you change the system in the options (products_info), you must update all the code. 
You must understand, it's not a simple work and take lot of time and the repercussion inside all Osc is very important.

Select is one selection ==> ok work
Radio field is one  ===> ok work
Checkbox is many selection ===> not work
Select multiple  is many selection ===> not work

There is no add on works with the last 2 options above, just partial with some error inside, not recommended to install.

 

 

 

Thank you for the warning.

But I am just using the text to display..so probably it shall not effect the whole cart functionality. 

Thank you again to all my oscommerce friends to be so helpful,

Warm Regds 

Radhavallabh 

Link to comment
Share on other sites

1 hour ago, radhavallabh said:

I have almost 6 attributes to each product..So difficult to show all on listing page.

Then you need to do some more work!

1) make a new function to out put only part of the array! sometnig like this

$newArray = array();

foreach($array as $value) {
    $newArray[] = $value['groupname'];
}

2) use the PHP command array_slice or map or another! to split you array in to chunks and only output the part you need. somthing like this, ( stright out of the php manual) there are other ways this can be done also (array_chunk)


<?php
$input = array("a", "b", "c", "d", "e");

$output = array_slice($input, 2);      // returns "c", "d", and "e"
$output = array_slice($input, -2, 1);  // returns "d"
$output = array_slice($input, 0, 3);   // returns "a", "b", and "c"

// note the differences in the array keys
print_r(array_slice($input, 2, -1));
print_r(array_slice($input, 2, -1, true));
?>

 

 

Link to comment
Share on other sites

NOT a good solution but if your stuck then a simple hack to code can give this. But it's crude and not very nice as you end up hard coding the attribute name into the code!! I'll PM you the hack as it's not fit for public display :(.

image.png.58c7b066707e5b4827a639cdf61fed40.png

 

Link to comment
Share on other sites

Oh and hack will only work if selected attribute is the first entered for all product! as osC simply sorts by order entered. So if on say a new product you add size as the first attribute your stuffed! Guess you could add another sort before the filter? but it's all getting very messy.

 

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...