Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Products Specifications


kymation

Recommended Posts

do we have a problem with the value 0 ?

when i add the value 0 to the specifications and filters and apply "Show all" , the filter display by default the value 0, not "Show all".

 

even if i select the "show all" from the filter drop down, the page load and display the value 0 again.

Link to comment
Share on other sites

  • 2 weeks later...

I think I found a bug.

 

If you defined a specification in 1 language, save it, and then edit it and add a second language the second language does not get added to the database. I am guessing because the form submits as an UPDATE query but since that specification does not exist in the database yet it is not being added.

 

I am in the process of turning my store into a multi lingual one, That is why I am facing this issue. I can duplicate the entries in the database directly and change the language ID but that takes a lot of time, and is not the cleanest. So maybe I will look into fixing it in the code/

Link to comment
Share on other sites

Specifications are added for each of the languages existing at that time. There is no mechanism to automatically update them if another language is added later. I suppose that can be considered a bug, but I'm not sure how you would get around it.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Right that makes sense, The only thing that I think is a "bug" is that if I type a name in the second blank language box, It should then be added.

 

So right now I have English and French, the English says color, the french is blank. If I add color to the french box, it should add it as language_id 2 but it just stays blank.

 

I think that is buggy.

Link to comment
Share on other sites

Yes, the box should not show if there is no label for it and it won't be added to the database. I should add some logic to take care of that. It would be much better to detect the new language and take some action based on that, but that's a much harder task.

 

Regards

Jim.

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Yea to be honest it was not such a problem for me since there are not many specifications at the moment so just inserting via sql was pretty easy. But I can see it being a big pain if in the future I would need to add a new language like that.

Link to comment
Share on other sites

  • 3 weeks later...

I just installed this great contribution and is working fine. But I noticed something on the data base after Duplicate Product in admin.

 

As you know duplicate a product is a fast way to insert similar products. Once you do this, the module duplicates, (as many times you duplicate the product), all the entries in the db defining the specifications_id as 0 for all the extra unnecessary rows and columns.

 

This is not affecting the functionality of the module but it creates a huge unwanted extra data information in the data base.

 

Any suggestion?

Edited by dvale
Link to comment
Share on other sites

That's a bug. It should create an appropriate specifications_id for the duplicate product. I'll take a look at this as soon as I have some time.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

  • 2 weeks later...

In admin/categories.php, under this line

 case 'copy_to_confirm':

there is a block of code added to copy the specifications. That is not creating the proper ID for some reason. There's a database schema in the User's Manual if you need to figure out the relations between the tables.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I was looking at the code and I don't see any code provided for the specifications here.

 

case 'copy_to_confirm':
 if (isset($HTTP_POST_VARS['products_id']) && isset($HTTP_POST_VARS['categories_id'])) {
	 $products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);
	 $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);
	 if ($HTTP_POST_VARS['copy_as'] == 'link') {
	 if ($categories_id != $current_category_id) {
		 $check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$products_id . "' and categories_id = '" . (int)$categories_id . "'");
		 $check = tep_db_fetch_array($check_query);
		 if ($check['total'] < '1') {
		 tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$categories_id . "')");
		 }
	 } else {
		 $messageStack->add_session(ERROR_CANNOT_LINK_TO_SAME_CATEGORY, 'error');
	 }
	 } elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') {
	 $product_query = tep_db_query("select products_extra_charge, products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
	 $product = tep_db_fetch_array($product_query);
	 tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model, products_extra_charge, products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_extra_charge']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "', now(), " . (empty($product['products_date_available']) ? "null" : "'" . tep_db_input($product['products_date_available']) . "'") . ", '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");
	 $dup_products_id = tep_db_insert_id();

 

Should I add the products_specifications line between the existing lines.............like this

 

$product_query = tep_db_query("select products_extra_charge, products_specifications, products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
	    $product = tep_db_fetch_array($product_query);
	    tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_specifications, products_model, products_extra_charge, products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_extra_charge']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "',  now(), " . (empty($product['products_date_available']) ? "null" : "'" . tep_db_input($product['products_date_available']) . "'") . ", '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");

Edited by dvale
Link to comment
Share on other sites

This part:

 

// Products Specifications
tep_db_query ("insert into " . TABLE_PRODUCTS_DESCRIPTION . " (
products_id,
language_id,
products_name,
products_description,
products_tab_1,
products_tab_2,
products_tab_3,
products_tab_4,
products_tab_5,
products_tab_6,
products_viewed
) values (
'" . (int) $dup_products_id . "',
'" . (int) $description['language_id'] . "',
'" . tep_db_input($description['products_name']) . "',
'" . tep_db_input ($description['products_description']) . "',
'" . tep_db_input ($description['products_tab_1']) . "',
'" . tep_db_input ($description['products_tab_2']) . "',
'" . tep_db_input ($description['products_tab_3']) . "',
'" . tep_db_input ($description['products_tab_4']) . "',
'" . tep_db_input ($description['products_tab_5']) . "',
'" . tep_db_input ($description['products_tab_6']) . "',
'0'
)");
}

 

and this:

 

// Start Products Specifications
$specifications_query = tep_db_query ("select specifications_id,
language_id,
specification
from " . TABLE_PRODUCTS_SPECIFICATIONS . "
where products_id = '" . (int)$products_id . "'
");
while ($specifications = tep_db_fetch_array ($specifications_query) ) {
tep_db_query ("insert into " . TABLE_PRODUCTS_SPECIFICATIONS . " (
products_id,
specifications_id,
language_id,
specification) values (
'" . (int) $dup_products_id . "',
'" . (int) $specifications['specification_description_id'] . "',
'" . (int)$specifications['language_id'] . "',
'" . tep_db_input ($specifications['specification']) . "')
");
} // while ($specifications
// End Products Specifications

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Just to make sure we are in the same page. I'm using the filters ONLY. I already have the tab_descriptions installed in my website so I'm not using the tabs provided with the module.

 

products_tab_1,

products_tab_2,

products_tab_3,

products_tab_4,

products_tab_5,

products_tab_6,

 

take a look:

https://www.shopperstation.com/games-c-4_5_6/?language=en

 

So when I duplicate a product, everything gets duplicate fine except for the filter selections and creates the problem described above in the database.

 

What I'm doing right now is deleting manually the database entries created when duplicate a product. I guess until I figure how to duplicate everything properly.

 

Regards,

Vale

Edited by dvale
Link to comment
Share on other sites

  • 2 weeks later...

Hi Jim,

Just upgraded my store from rca2.2 to 2.3.3. I've been using PS for rca2.2 version and it worked great.

 

Now i'm stuck with 2.3.3 while installing latest PS version, taken right from addon.oscommerce.com. My frontend is highly templated, for which i need a little help screaming, BUT... my admin is straight vanilla install and I can't even get it running.

 

The issue in admin is that on product detail page (edit or new), it simply lists from top to bottom the desc,spec, tab1, tab2 etc. with the input fields (text, drop down etc.). No Tabs like view... nothing. Yes it's getting specification data from db and filling up the fields.

 

I'm not sure but I suspect some jquery version is hindering my work. Right now it's 1.8.x, and not 1.9x for sure. But still i applied the 1.9x fix that you posted earlier on template_top.php.

 

Can i get a piece of advice from you where to look for the problem.

 

 

Thanks for your help.

 

Regards

Link to comment
Share on other sites

Is the rest of your Admin working? It uses the jQuery files and theme from the catalog side, so check that all of the stock jQuery files and the Redmond theme are still there and not corrupted. You can use View Source on your Admin pages to check the files it's calling for.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Thanks for guiding.

 

Yes All the rest of the Admin is working fine.

 

I just checked the stuff you mentioned and here is what i get in view source.

 

<link rel="stylesheet" type="text/css" href="http://www.mysite.com/ext/jquery/ui/redmond/jquery-ui-1.8.22.css">

<script type="text/javascript" src="http://www.mysite.com/ext/jquery/jquery-1.8.0.min.js"></script>

<script type="text/javascript" src="http://www.mysite.com/ext/jquery/ui/jquery-ui-1.8.22.min.js"></script>

 

Do you see anything wrong here?

 

 

I saw there is jquery fix also there.

 

<script type="text/javascript">

// fix jQuery 1.8.0 and jQuery UI 1.8.22 bug with dialog buttons; http://bugs.jqueryui.com/ticket/8484

if ( $.attrFn ) { $.attrFn.text = true; }

</script>

 

Also my template is using this Js

<script type="text/javascript" src="http://www.mysite.com/ext/flot/jquery.flot.js"></script>

 

 

 

I couldn't find anything else. I'm stuck :(

 

Regards

Link to comment
Share on other sites

The links look fine, but are the files actually there? Click on each link, one at a time. If you get a 404 not found page, the file is missing and needs to be replaced.

 

You may also need the following fix. It should not be necessary with the version of jQuery you're using, but it is with newer versions. Add this code just before the <head> tag in your template_top.php (both admin and catalog).

 

<script type="text/javascript">
// fix jQuery base tag bug
 $.fn.__tabs = $.fn.tabs;
 $.fn.tabs = function (a, b, c, d, e, f) {
   var base = location.href.replace(/#.*$/, '');
   $('ul>li>a[href^="#"]', this).each(function () {
  var href = $(this).attr('href');
  $(this).attr('href', base + href);
   });
   $(this).__tabs(a, b, c, d, e, f);
 };
</script>

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Yes all files are intact and responding on clicking the links.

 

I applied your fix, but no change in state.

 

I'm not new on your PS, as i've done installation of admin myself last time for 2.2RC2a and it worked great. I wonder what went wrong this time. Should i go for re-installation (though it's a nightmare to me).

Link to comment
Share on other sites

Using View Source on the Categories/Products page, look for this code at the beginning of the tabs:

 

<!-- Products Tabs BOF -->
 <script type="[url=""]text/javascript[/url]">
   $(function() {
     $( "#tabs" ).tabs({ selected: 0 });
   });
 </script>

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hello.

 

I just need to know if is me with the issue that the filter specifications are not duplicating as the rest of the data when duplicate a product in the admin. I'm being trying to turn this in the right way but my lack of time is not helping.

 

Does anybody have this problem? I really would like to know how to fix it.

 

Regards,

Paul

Link to comment
Share on other sites

Filters are not a property of the product. The only thing that should be duplicated is the Product Specifications that apply to that product. I have had reports of a bug in the copy feature with the Product Specifications, but I haven't had a chance to check it out.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Using View Source on the Categories/Products page, look for this code at the beginning of the tabs:

 

<!-- Products Tabs BOF -->
<script type="[url=""]text/javascript[/url]">
$(function() {
$( "#tabs" ).tabs({ selected: 0 });
});
</script>

 

Regards

Jim

 

 

 

There was an issue

 [url]...[/url]

was missing. I fixed that. Now i see bullets appearing but again listing down from top to bottom, not tabs.

 

If it doesn't bother you much, here is a viewsource snapshot of tabs stuff.

 

 

<!-- Products Tabs BOF -->
<script type="[url=""]text/javascript[/url]">
$(function() {
 $( "#tabs" ).tabs({ selected: 0 });
});
</script>
<div id="tabs">
<ul>
 <li><a href="#tabs-0" class="active"><span></span></a></li>
 <li><a href="#tabs-1"><span></span></a></li>
 <li><a href="#tabs-5"><span></span></a></li>
 <li><a href="#tabs-6"><span></span></a></li>
 <li><a href="#tabs-7"><span></span></a></li>
</ul>
<div id="tabs-0">
		 <table border="0" cellspacing="0" cellpadding="1">
			 <tr align="left">
			 <td valign="top" class="main">Products Description: </td>
			 <td><table border="0" cellspacing="0" cellpadding="0">
				 <tr>
				 <td valign="top"><img src="http://66.147.244.218/~alazizon/alazizonlinecom-pk/includes/languages/english/images/icon.gif" border="0" alt="English" title="English" /></td>
				 <td class="main"><textarea name="products_description[1]" id="products_description[1]" cols="70" rows="10" id = "products_description[1]">Keyboard Dell Latitude D420</textarea></td>
				 </tr>
				 <tr>
				 <td><img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="10" /></td>
				 </tr>
			 </table></td>
			 </tr>
			 <tr>
			 <td><img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="10" /></td>
			 </tr>
		 </table>
		 </div>
<div id="tabs-1">
		 <table border="0" cellspacing="0" cellpadding="1">
			 <tr align="left">
			 <td>
 <table border="0" cellspacing="0" cellpadding="0">
	 <tr>
	 <td class="main" valign="top">
Weight <br><div class="description"></div> 		 </td>
	 <td><table border="0" cellspacing="0" cellpadding="0">
		 <tr>
		 <td class="main" valign="top"><img src="/alazizonlinecom-pk/includes/languages/english/images/icon.gif" border="0" alt="English" title="English" /> </td>
		 <td class="main">
<textarea name="products_specification[181][1]" id="products_specification[181][1]" cols="70" rows="3">430 g</textarea>			 </td>
		 </tr>
		 <tr>
		 <td colspan="2"><img src="images/pixel_trans.gif" border="0" alt="" width="1" height="10" /></td>
		 </tr>
	 </table></td>
	 </tr>

	 <tr>
	 <td class="main" valign="top">
Letters <br><div class="description"></div> 		 </td>
	 <td><table border="0" cellspacing="0" cellpadding="0">
		 <tr>
		 <td class="main" valign="top"><img src="/alazizonlinecom-pk/includes/languages/english/images/icon.gif" border="0" alt="English" title="English" /> </td>
		 <td class="main">
<textarea name="products_specification[183][1]" id="products_specification[183][1]" cols="70" rows="3">English</textarea>			 </td>
		 </tr>
		 <tr>
		 <td colspan="2"><img src="images/pixel_trans.gif" border="0" alt="" width="1" height="10" /></td>
		 </tr>
	 </table></td>
	 </tr>

	 <tr>
	 <td class="main" valign="top">
Layout <br><div class="description"></div> 		 </td>
	 <td><table border="0" cellspacing="0" cellpadding="0">
		 <tr>
		 <td class="main" valign="top"><img src="/alazizonlinecom-pk/includes/languages/english/images/icon.gif" border="0" alt="English" title="English" /> </td>
		 <td class="main">
<textarea name="products_specification[182][1]" id="products_specification[182][1]" cols="70" rows="3">US Version</textarea>			 </td>
		 </tr>
		 <tr>
		 <td colspan="2"><img src="images/pixel_trans.gif" border="0" alt="" width="1" height="10" /></td>
		 </tr>
	 </table></td>
	 </tr>

	 <tr>
	 <td class="main" valign="top">
Color <br><div class="description"></div> 		 </td>
	 <td><table border="0" cellspacing="0" cellpadding="0">
		 <tr>
		 <td class="main" valign="top"><img src="/alazizonlinecom-pk/includes/languages/english/images/icon.gif" border="0" alt="English" title="English" /> </td>
		 <td class="main">
<textarea name="products_specification[179][1]" id="products_specification[179][1]" cols="70" rows="3">Black</textarea>			 </td>
		 </tr>
		 <tr>
		 <td colspan="2"><img src="images/pixel_trans.gif" border="0" alt="" width="1" height="10" /></td>
		 </tr>
	 </table></td>
	 </tr>

	 <tr>
	 <td class="main" valign="top">
Condition <br><div class="description"></div> 		 </td>
	 <td><table border="0" cellspacing="0" cellpadding="0">
		 <tr>
		 <td class="main" valign="top"><img src="/alazizonlinecom-pk/includes/languages/english/images/icon.gif" border="0" alt="English" title="English" /> </td>
		 <td class="main">
<textarea name="products_specification[178][1]" id="products_specification[178][1]" cols="70" rows="3">New</textarea>			 </td>
		 </tr>
		 <tr>
		 <td colspan="2"><img src="images/pixel_trans.gif" border="0" alt="" width="1" height="10" /></td>
		 </tr>
	 </table></td>
	 </tr>

 </table>
			 </td>
			 </tr>
		 </table>
		 </div>
<div id="tabs-5">
		 <table border="0" cellspacing="0" cellpadding="1">
			 <tr align="left">
....

Edited by mobiside
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...