X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Pro: Global "Extra Fields" that all Providers see. (https://forum.x-cart.com/showthread.php?t=14062)

IndieDepot 05-18-2005 12:51 AM

Pro: Global "Extra Fields" that all Providers see.
 
I asked around and got no help, so I looked into doing this myself. I am no PHP programmer, but I know enough to get a few things like I need by looking at other stuff and seeing how it works.

I needed to make my stores Root Provider be able to add Extra Fields so that ALL my regular Providers will be able to see them in their add/modify product form.

This simple mod does not affect the functionality of each regular providers Extra Fields capabilities, and they can add their own set of extra fields ON TOP of the Global Extra Fields created by the Root Provider...

1. First you must make a Root Provider account. let's call it 'root'.

2. Second you must open the ./x-cart/Extra_Fields/extra_fields.php file and go to line 39:

Code:

$provider_condition = ($single_mode?"":" AND $sql_tbl[extra_fields].provider='$extra_fields_provider'");

3. Third, you must simply add some code towards the end of that line to look like this:

Code:

$provider_condition = ($single_mode?"":" AND $sql_tbl[extra_fields].provider='$extra_fields_provider' OR $sql_tbl[extra_fields].provider='root'");

**notice I had to put the account username 'root' in the code towards the end. You can substitute this name for whatever the username of your Root Provider is.

That's it.

Now all your Providers will see the Extra fields created by your Root Provider, and they will display on the product profile in the store.

enjoy...

- Shannon

balinor 06-08-2005 06:07 PM

Nice one! Quite a few people have asked for this. Thanks for taking the time to work it out!

jagorny 11-15-2005 10:26 PM

Thanks but no thanks...
 
Actually that's an elegant hack. I liked it and used it but ran into problem #2 so hopefully through our teamwork we can provide a full solution.

Yes your solution makes extras global and visible, but try including any of these global extra fields in an imported csv and it fails. The import function will not find the global and will simply recreate the provider specific extra field to correspond to the data it is trying to push.

It is necessary to modify the following:

file: /cart/provider/import.php

Search for #set extra_fields and it takes to around line 1049 (4.0.16)

make the following adjustment to the query that pulls valid extra_fields based on the label:

replace $tmp_provider_condition...

normally it represents " AND provider='$login'"

it should be " AND (provider='$login' OR provider='root')"

assuming you have a root login provider creating global extra fields...

[/code]

jagorny 11-15-2005 10:26 PM

Thanks but no thanks...
 
Actually that's an elegant hack. I liked it and used it but ran into problem #2 so hopefully through our teamwork we can provide a full solution.

Yes your solution makes extras global and visible, but try including any of these global extra fields in an imported csv and it fails. The import function will not find the global and will simply recreate the provider specific extra field to correspond to the data it is trying to push.

It is necessary to modify the following:

file: /cart/provider/import.php

Search for #set extra_fields and it takes to around line 1049 (4.0.16)

make the following adjustment to the query that pulls valid extra_fields based on the label:

replace $tmp_provider_condition...

normally it represents " AND provider='$login'"

it should be " AND (provider='$login' OR provider='root')"

assuming you have a root login provider creating global extra fields...

ChrisBarnett 09-28-2007 08:56 PM

Re: Pro: Global "Extra Fields" that all Providers see.
 
Jacob,

When you tried this, did it show up in other providers other than root?

For me, it won't show up in providers other than root.

Code:



# Use this condition when single mode is disabled
#
# $provider_condition = ($single_mode ? "" : "AND provider='$login'");
$provider_condition = ($single_mode? "":"AND $sql_tbl[extra_fields].provider='$extra_fields_provider' OR $sql_tbl[extra_fields].provider='root'");
#
# Handle POST request
#



All times are GMT -8. The time now is 10:49 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.