Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Easy Populate & Products Attributes


VJ

Recommended Posts

ok, did that and now the font tag looks good. its retaining the same colour, run a compare program on the databases and now i see that where ever i had 2 quotes like :

				if (ini_get('magic_quotes_runtime') == 1){
				// The magic_quotes_runtime are on, so lets account for them
				// check if the last character is a quote;
				// if it is, chop off the quotes.
				if (substr($items[$i],-1) == '"'){
					$items[$i] = substr($items[$i],2,strlen($items[$i])-4);
				}
				// now any remaining doubled double quotes should be converted to one doublequote
				$items[$i] = str_replace('\"\"',""",$items[$i]);
				if ($replace_quotes){
					$items[$i] = str_replace('\"',""",$items[$i]);
					$items[$i] = str_replace("\'","'",$items[$i]);
				}
			} else { // no magic_quotes are on
				// check if the last character is a quote;
				// if it is, chop off the 1st and last character of the string.
				if (substr($items[$i],-1) == '"'){
					$items[$i] = substr($items[$i],1,strlen($items[$i])-2);
				}
				// now any remaining doubled double quotes should be converted to one doublequote
				$items[$i] = str_replace('""',""",$items[$i]);
				if ($replace_quotes){
					$items[$i] = str_replace('"',""",$items[$i]);
					$items[$i] = str_replace("'","'",$items[$i]);
				}
			}

replace with

				if (ini_get('magic_quotes_runtime') == 1){
				// The magic_quotes_runtime are on, so lets account for them
				// check if the last character is a quote;
				// if it is, chop off the quotes.
				if (substr($items[$i],-1) == '"'){
					$items[$i] = substr($items[$i],2,strlen($items[$i])-4);
				}
				// now any remaining doubled double quotes should be converted to one doublequote
				if ($replace_quotes){
					if ($excel_safe_output == false) {
					  $items[$i] = str_replace('\"\"',""",$items[$i]);
					}
					$items[$i] = str_replace('\"',""",$items[$i]);
					$items[$i] = str_replace("\'","'",$items[$i]);
				}
			} else { // no magic_quotes are on
				// check if the last character is a quote;
				// if it is, chop off the 1st and last character of the string.
				if (substr($items[$i],-1) == '"'){
					$items[$i] = substr($items[$i],1,strlen($items[$i])-2);
				}
				// now any remaining doubled double quotes should be converted to one doublequote
				if ($replace_quotes){
					if ($excel_safe_output == false) {
					  $items[$i] = str_replace('""',""",$items[$i]);
					}
					$items[$i] = str_replace('"',""",$items[$i]);
					$items[$i] = str_replace("'","'",$items[$i]);
				}
			}

Link to comment
Share on other sites

I should thank everyone here for their assistance, now i could upload EP successfully but there is still a problem:

 

The products in admin appear only in the default language section but not in other languages.

you must mean the category language is wrong?

 

Product languages are handled correctly.

 

If you are still using v2.72, I can't suggest any solution. I'm only supporting my version 2.76d.

 

In the 2.76x version there is this code:

 

//elari check default language_id from configuration table DEFAULT_LANGUAGE
$epdlanguage_query = tep_db_query("select languages_id, name from " . TABLE_LANGUAGES . " where code = '" . DEFAULT_LANGUAGE . "'");
if (tep_db_num_rows($epdlanguage_query)) {
$epdlanguage = tep_db_fetch_array($epdlanguage_query);
$epdlanguage_id   = $epdlanguage['languages_id'];
$epdlanguage_name = $epdlanguage['name'];
} else {
Echo 'Strange but there is no default language to work... That may not happen, just in case... ';
}

 

Categories are not handled with language correctly. It pulls the default language from the database and assigns it to any importing categories.

the proper way is to, at least, use the currently chosen language in the admin so there is, at least, some control.

 

that is how v2.76e will be handled.

 

If you have that code in your version, try this mod. (not sure what elari was thinking here)

if (!empty($languages_id) && !empty($language)) {
 $epdlanguage_id   = $languages_id;
 $epdlanguage_name = $language;
} else {
//elari check default language_id from configuration table DEFAULT_LANGUAGE
$epdlanguage_query = tep_db_query("select languages_id, name from " . TABLE_LANGUAGES . " where code = '" . DEFAULT_LANGUAGE . "'");
if (tep_db_num_rows($epdlanguage_query)) {
$epdlanguage = tep_db_fetch_array($epdlanguage_query);
$epdlanguage_id   = $epdlanguage['languages_id'];
$epdlanguage_name = $epdlanguage['name'];
} else {
Echo 'Strange but there is no default language to work... That may not happen, just in case... ';
}
}

 

no guarentee, coded on the fly. This will import your cateogries using the currently chosen language in your admin, hope this helps.

Link to comment
Share on other sites

so you want to use the osCommerce file download feature. where someone makes a purchase and downloads a file afterwards. I guess it was the "attach a file" that threw me. This contribution doesn't handle file download attributes.

Thank you,

Is there an easier way? (or any contribution?)

-Eric Schrader

Link to comment
Share on other sites

I have done a trick and it worked. I have first created the new categories and gave it names in all the languages, I also created a subcategory and then upload the EP txt file. And the products now can be seen in both admin side and costumer side.

 

But, another problem has appeared :'( In English section, and only in English not in other languages, I can see a deformation in my store when I select one of the new added products only. Other products no problem.

Link to comment
Share on other sites

Thank you,

Is there an easier way? (or any contribution?)

Not that I know of, but I haven't search for EP knockoffs. The project this was based on is still in the top few pages of the most popular list. Excel Import 1.51. Don't know what it does though.

it is something that should be done eventually, but other issues with this project have priority.

Edited by surfalot
Link to comment
Share on other sites

hi todd, again thanks for your help and time on this, glad i could help in making this better. its probably quite late for this but what i forgot to mention was that for my product description i am using FCKeditor which is generating the html , i hope i am not too late with this info...

currently using OSC2.2MS2 051113 with the following contributions:

 

AJAX Attributemanager 2.1 - All_products 4.4 - Banner manager 1.5b - banner hack picture in manager * description in product listing hack ms2 v2.4 * drop shadow boxes v.1.1 * Easy populater 2.76d-ms2 by surfalot * FCKEditor * header tag controller v2.5.9 * jcssmenu * LoginBox 5.6 * option type feature v1.71 * OSC-Cach-v1.1 * popup_imagecleaned_stilized_2 * Remove from cart button hack * scrolling bestsellers * Article manager1.4 * Links Manager v1.14. * proffessional invoice&packingslip 6.1 * Ultimate SEO URLs

Personaly i think all these features NEED to be in the main core as they are quite basic features that are missing. but then again what do i know?

Link to comment
Share on other sites

hi todd, again thanks for your help and time on this, glad i could help in making this better. its probably quite late for this but what i forgot to mention was that for my product description i am using FCKeditor which is generating the html , i hope i am not too late with this info...

cool. shouldn't make any difference. my goal with the excel safe option was to eliminate any issues with special chars. which should allow any html to remain intact.

Link to comment
Share on other sites

my html skills are limited, but should not 2 double quotes like style = "" not be changed to style="". other wise the quotes are not terminated and the whole html is askewed? why are specificaly changed in to 1 " instead of 2 ?

currently using OSC2.2MS2 051113 with the following contributions:

 

AJAX Attributemanager 2.1 - All_products 4.4 - Banner manager 1.5b - banner hack picture in manager * description in product listing hack ms2 v2.4 * drop shadow boxes v.1.1 * Easy populater 2.76d-ms2 by surfalot * FCKEditor * header tag controller v2.5.9 * jcssmenu * LoginBox 5.6 * option type feature v1.71 * OSC-Cach-v1.1 * popup_imagecleaned_stilized_2 * Remove from cart button hack * scrolling bestsellers * Article manager1.4 * Links Manager v1.14. * proffessional invoice&packingslip 6.1 * Ultimate SEO URLs

Personaly i think all these features NEED to be in the main core as they are quite basic features that are missing. but then again what do i know?

Link to comment
Share on other sites

my html skills are limited, but should not 2 double quotes like style = "" not be changed to style="". other wise the quotes are not terminated and the whole html is askewed? why are specificaly changed in to 1 " instead of 2 ?

yes, 2 double quotes like style = "" should not be changed to style="". but it shouldn't do that if $replace_quotes = false is set.

after export to CSV it should be: style = """". then upon import to the database it should be: style = "" or: style = \"\". depending on how your magicquotes is set in your php.

 

why are specificaly changed in to 1 " instead of 2 ?

you mean why was it? not sure, maybe just bad logic to begin with.

Edited by surfalot
Link to comment
Share on other sites

$items[$i] = str_replace('\"\"',""",$items[$i]);

this is from your new code, is this not basicaly replacing 2 quotes with 1?

currently using OSC2.2MS2 051113 with the following contributions:

 

AJAX Attributemanager 2.1 - All_products 4.4 - Banner manager 1.5b - banner hack picture in manager * description in product listing hack ms2 v2.4 * drop shadow boxes v.1.1 * Easy populater 2.76d-ms2 by surfalot * FCKEditor * header tag controller v2.5.9 * jcssmenu * LoginBox 5.6 * option type feature v1.71 * OSC-Cach-v1.1 * popup_imagecleaned_stilized_2 * Remove from cart button hack * scrolling bestsellers * Article manager1.4 * Links Manager v1.14. * proffessional invoice&packingslip 6.1 * Ultimate SEO URLs

Personaly i think all these features NEED to be in the main core as they are quite basic features that are missing. but then again what do i know?

Link to comment
Share on other sites

sorry again for fluding this topic but,

i have attributes for most of my products and when downloading the attribute to excel it can not load as the columns reach KZ (286 columns).

the only spreadsheet program i found that can handle it is quattro pro X3 from corel wordperfect office suite (available for a free trial).

the problem is that the excelSAFE option does not work well for it, and all the "-quotes are stripped and when importing it back in the shop it messes up everything. surfalot - do you think there is a way to tweak the contribution so it would work well with quattro pro X3 as well?

currently using OSC2.2MS2 051113 with the following contributions:

 

AJAX Attributemanager 2.1 - All_products 4.4 - Banner manager 1.5b - banner hack picture in manager * description in product listing hack ms2 v2.4 * drop shadow boxes v.1.1 * Easy populater 2.76d-ms2 by surfalot * FCKEditor * header tag controller v2.5.9 * jcssmenu * LoginBox 5.6 * option type feature v1.71 * OSC-Cach-v1.1 * popup_imagecleaned_stilized_2 * Remove from cart button hack * scrolling bestsellers * Article manager1.4 * Links Manager v1.14. * proffessional invoice&packingslip 6.1 * Ultimate SEO URLs

Personaly i think all these features NEED to be in the main core as they are quite basic features that are missing. but then again what do i know?

Link to comment
Share on other sites

I've sent a message to Jacobr as well but if anyone else could help with this I'd be grateful. I am new to OSCommerce and I want to know how to add this piece of code (see Jacob's code below): Does this go in easypopulate and if so where? Thanks. I am maintaining a shopping cart and came across this bug that easypopulate is not handling negative values properly.

 

Thanks.

 

Nicole

 

 

Ok, here's the fix for those who want to get rid of every instance of a - sign from the options_values_price column without touching the price_prefix column (leaving the negative sign EP plugs in there intact)

update products_attributes set options_values_price = ABS(options_values_price)

 

This query will cause options_values_price to be set to the absolute value of whatever number is there - so the absolute value of -43 is... <drum roll> 43!

 

Which of course, when combined with the - sign in the price_prefix column gives you a product attribute that subtracts the value from the product price properly, and follows the standard for how you display negative monetary values.

 

All credit for the query goes to wizardsandwars - huge thanks to him!

 

Jacob

Link to comment
Share on other sites

Surfalot , i think i found another bug. with the below settings, if i download a custom file of model,name,price quantity,image,added, available,category. make my changes and upload the file. The descriptions(which were not downloaded) are wiped out

 

i am using these settings:

$tempdir = DIR_FS_DOCUMENT_ROOT . "temp/";

global $maxrecs;
$maxrecs = 300; // default, seems to work for most people.  Reduce if you hit timeouts

global $default_images, $default_image_manufacturer, $default_image_product, $default_image_category;

$default_image_product = '';
$default_image_category = '';

global $active, $inactive, $zero_qty_inactive, $deleteit;
$active = 'Active';
$inactive = 'Inactive';

$zero_qty_inactive = false;

global $modelsize;
$modelsize = 12;


global $price_with_tax;
$price_with_tax =true;


global $replace_quotes;
$replace_quotes = false;

global $separator;
$separator = "\t"; // tab is default



global $excel_safe_output;
$excel_safe_output = true; // default is: false
if ($excel_safe_output == true) { $separator = ","; }

global $preserve_tabs_cr_lf;
$preserve_tabs_cr_lf = true; // default is: false

global $max_categories;
$max_categories = 7; // 7 is default
global $products_with_attributes;
$products_with_attributes = false; 

global $products_attributes_stock;
$products_attributes_stock = false; 


global $attribute_options_select;

global $show_ep_settings;
$show_ep_settings = true; // default is: false

currently using OSC2.2MS2 051113 with the following contributions:

 

AJAX Attributemanager 2.1 - All_products 4.4 - Banner manager 1.5b - banner hack picture in manager * description in product listing hack ms2 v2.4 * drop shadow boxes v.1.1 * Easy populater 2.76d-ms2 by surfalot * FCKEditor * header tag controller v2.5.9 * jcssmenu * LoginBox 5.6 * option type feature v1.71 * OSC-Cach-v1.1 * popup_imagecleaned_stilized_2 * Remove from cart button hack * scrolling bestsellers * Article manager1.4 * Links Manager v1.14. * proffessional invoice&packingslip 6.1 * Ultimate SEO URLs

Personaly i think all these features NEED to be in the main core as they are quite basic features that are missing. but then again what do i know?

Link to comment
Share on other sites

$items[$i] = str_replace('\"\"',""",$items[$i]);

this is from your new code, is this not basicaly replacing 2 quotes with 1?

 

if you are talking about this portion:

						if ($excel_safe_output == false) {
					  $items[$i] = str_replace('\"\"',""",$items[$i]);
					}

 

yes, it converts 2 double quote to 1 double quote. But not if excel safe is enabled since it would be innapropriete for this option. I didn't write it, I don't know why it's there, and I'm not removing it since I don't understand the purpose. I have only made small changes in the version I released since I don't want to throw folk that use this differently then myself. So far, you are the only one that has found a problem with it so I can't make the call on it's validity to other processes in the project. It may have been a catch to remove the doubled-double quotes that Excel uses when exporting CSV format file before the excel safe option I added. ;)

Link to comment
Share on other sites

I've sent a message to Jacobr as well but if anyone else could help with this I'd be grateful. I am new to OSCommerce and I want to know how to add this piece of code (see Jacob's code below): Does this go in easypopulate and if so where? Thanks. I am maintaining a shopping cart and came across this bug that easypopulate is not handling negative values properly.

 

yes, I came across that bug myself. What you are asking for would create another bug. It will be fixed in v2.76e.

 

this should fix it, find

 

$attribute_values_price_prefix = ($$v_attribute_values_price_var < 0) ? '-' : '+';

 

add after it:

 

						// if negative, remove the negative sign for storing since the prefix is stored in another field.
					if ( $$v_attribute_values_price_var < 0 ) $$v_attribute_values_price_var = strval(-((int)$$v_attribute_values_price_var));

Link to comment
Share on other sites

Surfalot , i think i found another bug. with the below settings, if i download a custom file of model,name,price quantity,image,added, available,category. make my changes and upload the file. The descriptions(which were not downloaded) are wiped out

 

yes, I'm aware of the issue. Product name and description should always be part of your export (for import) with v2.76d. v2.76e should fix that.

Link to comment
Share on other sites

Hello Surfalot

I installed EP 2.76d and it works OK except the products attributes download.

I cannot get it to appear in the quick links and when I try to download via the "download on the fly -Attributes.txt file I only get the model no and EOREOR.

Can you tell me what to look for to make the changes?

My stock items are all ZERO. Is this the problem?

Any advise will be thankfull

 

Vas

Link to comment
Share on other sites

Hi all...could someone dechiper this error for me?

 

Help me understand what is wrong. New install. Test Upload.

 

File uploaded.

Temporary filename: /tmp/phpCQZotg

User filename: 1stest.csv

Size: 1870

 

Warning: file(/home/dadano/public_html//TEMP1stest.csv) [function.file]: failed to open stream: No such file or directory in /home/dadano/public_html/admin/easypopulate.php on line 805

 

Warning: Invalid argument supplied for foreach() in /home/dadano/public_html/admin/easypopulate.php on line 844

Link to comment
Share on other sites

osC was installed directly into my public_html file on the server. I have no catalog file, and no temp file.

 

I made permissions 777 for the public html and created a /TEMP folder there.

 

Then modified the configure file to '/Temp'

 

Thought I was on the right track. Any help with the error above would be peachy.

 

Thanks,

Dano

Link to comment
Share on other sites

Hey all,

 

Before to install this contrib I wanna know what I have to do with this line :

 

6. Open your /catalog/admin/includes/configure.php file and set DOCUMENT_ROOT TO $DOCUMENT_ROOT DO THIS!! IT IS VERY IMPORTANT FOR YOUR SUCCESS. IF YOU DO NOT FLLOW THIS YOU WILL HAVE PROBLEMS!

 

Here's the line in my configure.php

 

define('DIR_FS_DOCUMENT_ROOT', '/home/maisonex/www/');

 

I don't understand what I have to change. My temp file is at the root of the site.

Thx in advance for your support ;)

Edited by exocom2
Link to comment
Share on other sites

Hi all,

 

I have two inquiries.

 

Firstly, I have a supplier who sends me a csv every morning with more than 1000 products w/ attributes.

 

SKU,ITEMID,DESCRIPTION,VENDOR,CAT,PRICE,Weight,SIZE,UNIT,SUB-CATEGORY,STATUS,FR,LA,AT,CH,DA,HO,KA,NJ,TA,MI,PO,LR

 

Could I configure easy populate to work with this format?

 

If yes, how so? If no, how close can I get it?

 

Secondly, I installed EP and am having some trouble with test uploads. osC was installed directly into my /public_html folder so I do not have a osCommerce/catalog/temp folder.

 

I created a /temp folder and modified permissions to 777. I modified the "$tempdir"

 

/admin/easypopulate.php is modified to

 

$tempdir = DIR_FS_DOCUMENT_ROOT . "/TEMP";

 

/admin/includes/configure.php is modified to

 

define('DIR_FS_$DOCUMENT_ROOT', '/home/dadano/public_html/');

 

I get an error

 

File uploaded.

Temporary filename: /tmp/phpIBIOEK

User filename: 1stest.csv

Size: 1870

 

Warning: file(/home/dadano/public_html//TEMP1stest.csv) [function.file]: failed to open stream: No such file or directory in /home/dadano/public_html/admin/easypopulate.php on line 805

 

Warning: Invalid argument supplied for foreach() in /home/dadano/public_html/admin/easypopulate.php on line 844

 

Ideas?

 

-Dano

Link to comment
Share on other sites

I got it figured out.

 

- osCommerce was installed directly into my public_html file so I did not have a /catalog/temp folder.

I created a /temp folder

 

All I had to do was change /temp to temp/

 

$tempdir = DIR_FS_DOCUMENT_ROOT . "TEMP/";

 

Dunno if I'm just delusionally tired but my admin/includes/configure.php reads:

 

define('DIR_FS_DOCUMENT_ROOT', '/home/dadano/public_html/'); // where the pages are located on the server

 

I havn't touched it and made the modification as advised, yet EP is working fine.

 

Hrm...

 

:blink:

Link to comment
Share on other sites

Hello Surfalot

I installed EP 2.76d and it works OK except the products attributes download.

I cannot get it to appear in the quick links and when I try to download via the "download on the fly -Attributes.txt file I only get the model no and EOREOR.

Can you tell me what to look for to make the changes?

My stock items are all ZERO. Is this the problem?

Any advise will be thankfull

 

Vas

 

php vers? php globals (on/off)

MySQL vers?

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