Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Is there a SQL command To Auto Fill DB Fields?


toyzonline

Recommended Posts

Hi Dudes & Dudettes,

 

I am looking to auto fill some fields possibly with an sql command. I do have easy populate but there are now too many fields for excel (oooops).

 

a) There is 1 field that I want to fill with a generic content whether it has a value or not

b) I have several added fields to my items and want to fill them only if they are empty

 

 

Cheers in advance

 

Ricardo

Complete Newbie On The Learn - Not A Programmer

But Learning As I Go

Link to comment
Share on other sites

Are you saying that you've changed the schema and have added some new fields? If so, yes, SQL can unconditionally set (override) the value of a particular field, or it can set default values. The default values would be done as part of the field definitions.

 

Is this a one-off job, or something you would be looking to do repeatedly? I would assume the former, as once you've set up a revised database schema, new records will automatically get the desired default field values. This is very basic database stuff, so perhaps you should be reading up on some SQL tutorials before you start messing with your site.

Link to comment
Share on other sites

Are you saying that you've changed the schema and have added some new fields? If so, yes, SQL can unconditionally set (override) the value of a particular field, or it can set default values. The default values would be done as part of the field definitions.

 

Is this a one-off job, or something you would be looking to do repeatedly? I would assume the former, as once you've set up a revised database schema, new records will automatically get the desired default field values. This is very basic database stuff, so perhaps you should be reading up on some SQL tutorials before you start messing with your site.

 

I simply used the Extra Fields Contribution. With these I have recently decided to assign a value to them even if not used (--) just for formatting reasons.

 

I have also header tags SEO and am using one of the fields to display something actionable on the item pages.

 

In both cases I am happy to manually add the values as and when I add new products, its just the changing the value of the already listed items is taking a while to do manually as there is over 5000 items..lol

Complete Newbie On The Learn - Not A Programmer

But Learning As I Go

Link to comment
Share on other sites

Easy populate allows for extra fields, if they are to the products_description table, I think.

 

Yeah I use easy populate but it doesn't give the option to download just the fields I need and cant download all of them as excel cant handle that many fields :(

Complete Newbie On The Learn - Not A Programmer

But Learning As I Go

Link to comment
Share on other sites

yes you can with a sql tool

 

where (xyz is null or xyz = '')

 

I don't think it is a difficult job, but it is dangerous if you don't know what you are doing.

 

you could also setup database defaults going forward to automate the population of system wide defaults.

On the other hand, you might change your pages display to show --- if there is not value

 

You either need to give more info here, or find some commercial help to help you find the best solution for your needs

KEEP CALM AND CARRY ON

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

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

 

Find the most frequent unique errors to fix:

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

Link to comment
Share on other sites

I have also header tags SEO and am using one of the fields to display something actionable on the item pages.

There is the sub-text option in Header Tags SEO meant to display extra text on the product page. That may be easier to handle. It can be added as a custom field in EP.

 

It the latest version of EP, there is an option to load from Extra Fields.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Cheers for the input guys - Although it would be great and less chance of mistakes I would of loved to use easy populate to resolve this, however I can no longer download a full csv as it has more than 256 columns and I cant single out the columns I need as they are not as standard (from other add-ons)

 

Field 1

 

The easiest (I think) field to complete is from the headertags seo contribution. Its the "Product Page Sub Text " field and I simply want to this field to have the same value for every item. As stated this is a one time run (although will save the solution in case the value changes in the future) as its not an issue completing the fields when adding new products, just a pain having to update the entire catalogue manually to get where I want to be.

Complete Newbie On The Learn - Not A Programmer

But Learning As I Go

Link to comment
Share on other sites

@@toyzonline You can add that field to EP using the custom field setting (the one for products description). Then create an EP file with just the model number column and that column. You can do that using the custom download section in EP. Fill in the text you want to use for that column and upload it.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

@@toyzonline You can add that field to EP using the custom field setting (the one for products description). Then create an EP file with just the model number column and that column. You can do that using the custom download section in EP. Fill in the text you want to use for that column and upload it.

 

I am using Easy Populate 2.8 231 not sure how to add those fields to the custom options

Complete Newbie On The Learn - Not A Programmer

But Learning As I Go

Link to comment
Share on other sites

I don't recall which that code was add but I'm sure it was before the version you are using. Added the fields is easy:

 

- Open the easypopulate.php file and find this line

$custom_fields[TABLE_PRODUCTS_DESCRIPTION] = array();

Edit that so it becomes

$custom_fields[TABLE_PRODUCTS] = array('products_head_sub_text' => 'Sub Text' ); 

Save it and look in the custom section of EP and you will see it there. Select it and click Build File. The file download will have the two columns you need.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I don't recall which that code was add but I'm sure it was before the version you are using. Added the fields is easy:

 

- Open the easypopulate.php file and find this line

$custom_fields[TABLE_PRODUCTS_DESCRIPTION] = array();

Edit that so it becomes

$custom_fields[TABLE_PRODUCTS] = array('products_head_sub_text' => 'Sub Text' ); 

Save it and look in the custom section of EP and you will see it there. Select it and click Build File. The file download will have the two columns you need.

 

 Cheers will back up everything and give that a go

Complete Newbie On The Learn - Not A Programmer

But Learning As I Go

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...