Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Products Fields Groups


thejudge99

Recommended Posts

Hi ,

ive just finished a new contribution which gives another way to create highly customizable new fields by making use of the Products Atrributes section.

 

The link is here

 

http://addons.oscommerce.com/info/8247

 

This contribution gives the administrator(s) the abilty to create extra field "Groups". These groups will be made up of attributes ( from the product options section) where each attribute will effectively be a new input field for any product linked to it.

There is no limit to how many attributes can be "attached" to a group - its basic functionality is the same as product attributes.

The bonus in using "Groups" is the way we can show Products in both the Listing and the Single view.

In the LIST view all products with the same Group will be shown together - this allows one to pick which of these attributes to show as column headers along with the standard headers ( Price , product name , image etc) , as well as its position ( through sorting, fully interacting with the Product Listing sorting)

This LISTing remains the same - whether viewing by Category , manufacturer , some filter or any search.

 

In the Single View all of these extra attributes/ fields ( if populated) in our attached group will be shown either Horizontally or Vertically ( configurable) in any order we choose ( using different sort order than the list view)

  • Fully Multi language compatible
  • Each new field is fully searchable (configurable)
  • Products of the same Group type will be shown together in category view , manufacturer view , a filter or any search.
  • Products not attached to a group will be shown like they do now.
  • Using Groups as a way to create new fields means not all products get the same fields - ie no meaningless / inappropriate fields on ALL products.

An example of the Listing view can be seen here ( last 2 DVDs have languages + audio in the columns)

 

http://ocraw.conzept....php?cPath=3_10

 

An example of the Single view can be seen here ( vertical mode)

http://ocraw.conzept...&products_id=10

 

Any suggestions , bug reporting , possible optimization / improvements would be grately appreciated.

 

Jules

 

ps. hope ive posted this in the right place

Edited by thejudge99
Link to comment
Share on other sites

  • 1 month later...
  • Replies 59
  • Created
  • Last Reply

Top Posters In This Topic

Sorry for the delay but heres the upgrade for this Contribution

 

http://addons.oscommerce.com/info/8247

 

The update will copy any Groups attached to a product as well as all populated fields ( during a COPY TO as Duplicate).

 

It also contains a small bug fix - a line of code that i accidentally deleted which throws an SQL error during an attempt to delete an Attribute Option.

 

Jules

Link to comment
Share on other sites

  • 2 weeks later...

$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_qty_blocks, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p2c.categories_id, ptdc.discount_categories_id, dc.discount_categories_name from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_DISCOUNT_CATEGORIES . " ptdc on p.products_id = ptdc.products_id left join " . TABLE_DISCOUNT_CATEGORIES . " dc using(discount_categories_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . tep_db_input($search) . "%' order by pd.products_name");

 

 

trying to merge this code (below) into the above code but keep getting sql syntax errors.

 

 

" . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCT_FIELDS_GROUPS_NAMES . " pfgn on p.products_fields_group_id = pfgn.products_fields_group_id and pfgn.language_id = '" . (int)$languages_id . "' where

Edited by ShaGGy
Link to comment
Share on other sites

question

 

are you trying to merge an already modified admin/categories.php ?

 

instruction 6H ( from within the supllied install.htm)

 

find

 

$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . tep_db_input($search) . "%' order by pd.products_name");
   } else {
     $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by pd.products_name");

 

and relace with

 

//   start Product Fields groups
     $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p2c.categories_id, p.products_fields_group_id , pfgn.products_fields_group_name from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c , " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCT_FIELDS_GROUPS_NAMES . " pfgn on p.products_fields_group_id = pfgn.products_fields_group_id and pfgn.language_id = '" . (int)$languages_id . "' where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . tep_db_input($search) . "%' order by pd.products_name");
   } else {
     $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status ,p.products_fields_group_id , pfgn.products_fields_group_name from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c , " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCT_FIELDS_GROUPS_NAMES . " pfgn on p.products_fields_group_id = pfgn.products_fields_group_id and pfgn.language_id = '" . (int)$languages_id . "' where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by pd.products_name");
//   end Product Fields groups

 

your posted line you are trying to merge appears twice 1 above and 1 below the } else { are you changing both?

Link to comment
Share on other sites

Managed to do it in the end i was omitting the left join as the line already had one but after a bit of asking around it turned out i needed to insert the left join as instructed even though there was one already in the query.

 

But I end up with a weird bug whereas if i add the attibs to ONE product it works fine but when i then add to a second item none of them show?

Link to comment
Share on other sites

Just finished another update ( still working on the install instructions - will be uploaded asap) - Now includes an extra column of SORTS to be used as TABS .

 

Demo can be seen here ( together with vertical view)

 

http://ocraw.conzept.de/product_info.php?cPath=1_4&products_id=2

 

I originally asked PRONUX for permission to include the TMS contribution to which he said yes ( thanks for that) but with the hard coded widths / calculations it wasnt dynamic enough ( we dont know the widths of fields - they change dynamically based on field / language ) , so i decided to use the TABS based on jquery ( the files / css is already built into oscommerce ) - styling is based on the current Themeroller theme if you changed it.

 

Install files will follow - probably sometime later today

Edited by thejudge99
Link to comment
Share on other sites

Hi Jules!

Thanks for a great contribution! It's exactly what I need.

I am trying to install, but I get an error when I try to download 1.1. I tried several times.

Any ideas of why that could be?

Thanks!

Verónica

Link to comment
Share on other sites

Error's as follows:

"Cannot open file: it does not appear to be a valid archive. If you downloaded this file, try downloading the file again."

And then I get an empty Zip folder.

 

Thanks!

Link to comment
Share on other sites

  • 4 weeks later...

Hi Jules,

 

Just installed this great contribution (the original, update 1.1 and 1.2). It works great. Only it seems to switch the "Tab" input with the "L_sort" input. If I set the "L_sort" positions in the "Tab" column, it works perfect.

If I set the "Tab" positions in the "L_sort" column, it shows the information but not under the right Tab, just all listed under the first tab (The Tabs show ok). Tabs and information link back to the index-page,

This doesn't look right.

 

Is this a know problem or could it be caused by other installed addons?

What could I do to solve it?

 

Thanks for your help.

 

Gerhard

Addons installed on my website:

 

- Addons Installed

- Advanced Special Offer Discounts

- AJAX-Attribute Manager for osc 2.3.1

- Banner box v1.1.1

- Dutch Language Pack

- Extra Pages-info box with admin for OSC2.3

- German Language Pack

- Login Box

- Multi-language Support for Configuration

- Multiple products manager

- Order Editor

- OSC PDF Catalogue 2.1

- PDF-Datasheet

- product Field Groups

- Quickly Update Product Stock

- Unit of weight

- YAG (Yet another Guestbook)

Link to comment
Share on other sites

hi sriahandcraft,

 

there is no problem that i know of - the 3 sorting columns work independently from each other - meaning filling all 3 with sorts will show the complete extra fields in all 3 places - products - listings and tabs

 

the tabs query ( from 9 in update 1.2) is

 

//start Product Fields groups tabs
$groups_tms_query = "select po.products_options_name , pfgv.products_fields_group_values from " . TABLE_PRODUCT_FIELDS_GROUPS_ATTRIBUTES . " pfga, " . TABLE_PRODUCTS_OPTIONS . " po, " . TABLE_PRODUCT_FIELDS_GROUPS_VALUES . " pfgv where pfga.products_fields_group_id = '".(int)$product_info['products_fields_group_id']."' and po.products_options_id = pfga.products_options_id and pfga.products_options_id = pfgv.products_options_id and pfga.products_fields_group_id  = pfgv.products_fields_group_id and po.language_id = '" . (int)$languages_id . "' and pfgv.language_id = '" . (int)$languages_id . "' and pfgv.products_id =  '".$product_info['products_id']."' and pfga.products_fields_group_tms_sort_order > 0  order by pfga.products_fields_group_tms_sort_order";

 

this is pulling data only where there is tab sort set which is greater than 0 - the other sorting fields have no influence - they could also be set or not.

 

Not sure why you see everything in 1 tab - if you have 1 sort field set in TAB then you will only have 1 tab - but should contain only that specific field - not all.

 

Could you try to remove all sorts from P.sort and L.Sort and populate on 2-3 sorts in TAB and make sure these 2-3 fields do have populated data.

 

As for the Links i believe the links will look like this #tab-1 - clicking them without the default javascript will take you to index.

 

The generated html should look something like this

<div id="tabs">
	    <!---Generate the tabs-->
		 <ul>
					 <li><a href="#tabs-1" >Product details</a></li>					 <li><a href="#tabs-2" >Key features</a></li>					 <li><a href="#tabs-3" >Technical details</a></li>					 <li><a href="#tabs-4" >Memory</a></li>					 <li><a href="#tabs-5" >Model</a></li>					 <li><a href="#tabs-6" >Size</a></li>					 <li><a href="#tabs-7" >Version</a></li>				 </ul>
	    <!--- End Generate the tabs-->

							    <!---Generate the tab contents-->
			 <div id="tabs-1">Introducingggggg the Millennium G400 Series - a dramatically different, high performance graphics experience. Armed with the industry's fastest graphics chip, the Millennium G400 Series takes explosive acceleration two steps further by adding unprecedented image quality, along with the most versatile display options for all your 3D, 2D and DVD applications. As the most powerful and innovative tools in your PC's arsenal, the Millennium G400 Series will not only change the way you see graphics, but will revolutionize the way you use your computer.</div>
			    <!---End Generate the tab contents-->
					   <!---Generate the tab contents-->
			 <div id="tabs-2"><ul><li>New Matrox G400 256-bit DualBus graphics chip</li><li>Explosive 3D, 2D and DVD performance</li><li>DualHead Display</li><li>Superior DVD and TV output</li><li>3D Environment-Mapped Bump Mapping</li><li>Vibrant Color Quality rendering </li><li>UltraSharp DAC of up to 360 MHz</li><li>3D Rendering Array Processor</li><li>Support for 16 or 32 MB of memory</li></ul></div>
			    <!---End Generate the tab contents-->
					   <!---Generate the tab contents-->
			 <div id="tabs-3"><ul><li>Exclusive 0dB thermal design dissipates heat efficiently without any noise</li>
<li>LP Bracket bundled: HTPC ready design. Free Low profile bracket bundled </li>
<li>EMI Shield Reduces 66% of electromagnetic interference for a stable signal, clearer screen display and a safer, healthier computing environment. </li></ul></div>
			    <!---End Generate the tab contents-->
					   <!---Generate the tab contents-->
			 <div id="tabs-4">32MB</div>
			    <!---End Generate the tab contents-->
					   <!---Generate the tab contents-->
			 <div id="tabs-5">Matrox G400</div>
			    <!---End Generate the tab contents-->
					   <!---Generate the tab contents-->
			 <div id="tabs-6">not so big</div>
			    <!---End Generate the tab contents-->
					   <!---Generate the tab contents-->
			 <div id="tabs-7">very old version</div>
			    <!---End Generate the tab contents-->

	    </div>

Link to comment
Share on other sites

i also made a slight update to the javascript added to template top ( 8 from update 1.2)

 

<!--- start Product Fields groups tabs -->
<script type="text/javascript">
  $(function(){
$('#tabs').tabs();
  });
  </script>
<!--- end Product Fields groups tabs -->

 

ive replace in preparation with

 

<!--- start Product Fields groups tabs -->
<script type="text/javascript">
  $(function(){

// Tabs
$( "#tabs" ).tabs({
	 fx: { opacity:'toggle', duration:'normal' },
	 ajaxOptions: {
	  error: function( xhr, status, index, anchor ) {
	   $( anchor.hash ).html(
	   "Couldn't load this tab. We'll try to fix this as soon as possible. " +
  "If this wouldn't be a demo." );
}
  }
});
$('#tabs ul li a').click(function () {location.hash = $(this).attr('href');});




  });
  </script>
<!--- end Product Fields groups tabs -->

 

to preload the tab from the url - the animation - and to allow ajax ( still to do on my end mostly taken from jquerys demo page) .

 

But this doesnt effect your problem.

Edited by thejudge99
Link to comment
Share on other sites

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