Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Pro: Global "Extra Fields" that all Providers see.

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 05-18-2005, 12:51 AM
 
IndieDepot IndieDepot is offline
 

Advanced Member
  
Join Date: May 2005
Posts: 30
 

Default 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
__________________
- www.TheShotList.com
X-Cart version 4.0.13
PHP 4.3.10
MySQL 4.0.23
Web server Apache
Operation system Linux
Perl 5.008004
XML parser (expat) 1.95.6
Reply With Quote
  #2  
Old 06-08-2005, 06:07 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Nice one! Quite a few people have asked for this. Thanks for taking the time to work it out!
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 11-15-2005, 10:26 PM
 
jagorny jagorny is offline
 

Senior Member
  
Join Date: Nov 2004
Posts: 98
 

Default 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]
__________________
Jacob Gorny
E-commerce Lead, Applications Developer
Greek Orthodox Archdiocese

Running X-Cart Pro 4.1.10
RHEL5 | Apache 2.2.8 | PHP 5.2.6
Reply With Quote
  #4  
Old 11-15-2005, 10:26 PM
 
jagorny jagorny is offline
 

Senior Member
  
Join Date: Nov 2004
Posts: 98
 

Default 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...
__________________
Jacob Gorny
E-commerce Lead, Applications Developer
Greek Orthodox Archdiocese

Running X-Cart Pro 4.1.10
RHEL5 | Apache 2.2.8 | PHP 5.2.6
Reply With Quote
  #5  
Old 09-28-2007, 08:56 PM
 
ChrisBarnett ChrisBarnett is offline
 

Member
  
Join Date: Jun 2007
Posts: 13
 

Default 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 #
__________________
X-Cart - 4.1.7 PRO
PHP - 4.4.4
MySQL 5.0.27
Apache 1.3.37
Linux
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 05:33 PM.

   

 
X-Cart forums © 2001-2020