Share tables between 2 sites on different domain using views

Your code modifications and patches you want to share with others.
Joomla! Apprentice
Joomla! Apprentice
Posts: 34
Joined: Sat Apr 14, 2007 3:37 pm

Share tables between 2 sites on different domain using views

Post by bonzo_bcn » Fri Dec 17, 2010 9:26 pm

I have two joomla installations under two domains in a VPS, they have separate accounts but I managed to share virtuemart product tables by using views on one database.

The problem I have is that admin user cannot be logged in on both sites at the same time. If I log to the backend of one site, the other is automatically logged off, even if the second user is not managing the virtuemart tables.

What can be the problem? The first online road cycling magazine in spanish

Joomla! Apprentice
Joomla! Apprentice
Posts: 26
Joined: Thu Feb 23, 2006 3:16 pm

Re: Share tables between 2 sites on different domain using v

Post by customnames » Wed Mar 16, 2011 12:41 pm

are you sharing the session table ?

If you got this to work drop us a line of how you solved it

Joomla! Apprentice
Joomla! Apprentice
Posts: 34
Joined: Sat Apr 14, 2007 3:37 pm

Re: Share tables between 2 sites on different domain using v

Post by bonzo_bcn » Wed Mar 16, 2011 9:20 pm

I did it with the following code:

Code: Select all

GRANT ALL PRIVILEGES ON `installation1\_joomla` . * TO 'installation2_joomla'@'localhost' WITH GRANT OPTION ;
GRANT ALL PRIVILEGES ON `installation1\_joomla` . * TO 'installation2'@'localhost' WITH GRANT OPTION ;

DROP TABLE jos_vm_auth_group;
DROP TABLE jos_vm_auth_user_group;
DROP TABLE jos_vm_auth_user_vendor;
DROP TABLE jos_vm_cart;
DROP TABLE jos_vm_category;
DROP TABLE jos_vm_category_xref;
DROP TABLE jos_vm_country;
DROP TABLE jos_vm_coupons;
DROP TABLE jos_vm_creditcard;
DROP TABLE jos_vm_csv;
DROP TABLE jos_vm_currency;
DROP TABLE jos_vm_export;
DROP TABLE jos_vm_function;
DROP TABLE jos_vm_manufacturer;
DROP TABLE jos_vm_manufacturer_category;
DROP TABLE jos_vm_module;
DROP TABLE jos_vm_orders;
DROP TABLE jos_vm_order_history;
DROP TABLE jos_vm_order_item;
DROP TABLE jos_vm_order_payment;
DROP TABLE jos_vm_order_status;
DROP TABLE jos_vm_order_user_info;
DROP TABLE jos_vm_payment_method;
DROP TABLE jos_vm_product;
DROP TABLE jos_vm_product_attribute;
DROP TABLE jos_vm_product_attribute_sku;
DROP TABLE jos_vm_product_category_xref;
DROP TABLE jos_vm_product_discount;
DROP TABLE jos_vm_product_download;
DROP TABLE jos_vm_product_files;
DROP TABLE jos_vm_product_mf_xref;
DROP TABLE jos_vm_product_price;
DROP TABLE jos_vm_product_product_type_xref;
DROP TABLE jos_vm_product_relations;
DROP TABLE jos_vm_product_reviews;
DROP TABLE jos_vm_product_type;
DROP TABLE jos_vm_product_type_1;
DROP TABLE jos_vm_product_type_parameter;
DROP TABLE jos_vm_product_votes;
DROP TABLE jos_vm_shipping_carrier;
DROP TABLE jos_vm_shipping_label;
DROP TABLE jos_vm_shipping_rate;
DROP TABLE jos_vm_shopper_group;
DROP TABLE jos_vm_shopper_vendor_xref;
DROP TABLE jos_vm_state;
DROP TABLE jos_vm_tax_rate;
DROP TABLE jos_vm_userfield;
DROP TABLE jos_vm_userfield_values;
DROP TABLE jos_vm_user_info;
/*DROP TABLE jos_vm_vendor;*/
DROP TABLE jos_vm_vendor_category;
DROP TABLE jos_vm_waiting_list;
DROP TABLE jos_vm_zone_shipping;
DROP TABLE `jos_users`;     
DROP TABLE `jos_session`;
DROP TABLE `jos_stats_agents`;
DROP TABLE `jos_core_acl_aro`;
DROP TABLE `jos_core_acl_aro_groups`;
DROP TABLE `jos_core_acl_aro_map`;
DROP TABLE `jos_core_acl_aro_sections`;
DROP TABLE `jos_core_acl_groups_aro_map`;

create view jos_vm_auth_group as select * from installation1_joomla.jos_vm_auth_group;
create view jos_vm_auth_user_group as select * from installation1_joomla.jos_vm_auth_user_group;
create view jos_vm_auth_user_vendor as select * from installation1_joomla.jos_vm_auth_user_vendor;
create view jos_vm_cart as select * from installation1_joomla.jos_vm_cart;
create view jos_vm_category as select * from installation1_joomla.jos_vm_category;
create view jos_vm_category_xref as select * from installation1_joomla.jos_vm_category_xref;
create view jos_vm_country as select * from installation1_joomla.jos_vm_country;
create view jos_vm_coupons as select * from installation1_joomla.jos_vm_coupons;
create view jos_vm_creditcard as select * from installation1_joomla.jos_vm_creditcard;
create view jos_vm_csv as select * from installation1_joomla.jos_vm_csv;
create view jos_vm_currency as select * from installation1_joomla.jos_vm_currency;
create view jos_vm_export as select * from installation1_joomla.jos_vm_export;
create view jos_vm_function as select * from installation1_joomla.jos_vm_function;
create view jos_vm_manufacturer as select * from installation1_joomla.jos_vm_manufacturer;
create view jos_vm_manufacturer_category as select * from installation1_joomla.jos_vm_manufacturer_category;
create view jos_vm_module as select * from installation1_joomla.jos_vm_module;
create view jos_vm_orders as select * from installation1_joomla.jos_vm_orders;
create view jos_vm_order_history as select * from installation1_joomla.jos_vm_order_history;
create view jos_vm_order_item as select * from installation1_joomla.jos_vm_order_item;
create view jos_vm_order_payment as select * from installation1_joomla.jos_vm_order_payment;
create view jos_vm_order_status as select * from installation1_joomla.jos_vm_order_status;
create view jos_vm_order_user_info as select * from installation1_joomla.jos_vm_order_user_info;
create view jos_vm_payment_method as select * from installation1_joomla.jos_vm_payment_method;
create view jos_vm_product as select * from installation1_joomla.jos_vm_product;
create view jos_vm_product_category_xref as select * from installation1_joomla.jos_vm_product_category_xref;
create view jos_vm_product_attribute as select * from installation1_joomla.jos_vm_product_attribute;
create view jos_vm_product_attribute_sku as select * from installation1_joomla.jos_vm_product_attribute_sku;
create view jos_vm_product_discount as select * from installation1_joomla.jos_vm_product_discount;
create view jos_vm_product_download as select * from installation1_joomla.jos_vm_product_download;
create view jos_vm_product_files as select * from installation1_joomla.jos_vm_product_files;
create view jos_vm_product_mf_xref as select * from installation1_joomla.jos_vm_product_mf_xref;
create view jos_vm_product_price as select * from installation1_joomla.jos_vm_product_price;
create view jos_vm_product_product_type_xref as select * from installation1_joomla.jos_vm_product_product_type_xref;
create view jos_vm_product_relations as select * from installation1_joomla.jos_vm_product_relations;
create view jos_vm_product_reviews as select * from installation1_joomla.jos_vm_product_reviews;
create view jos_vm_product_type as select * from installation1_joomla.jos_vm_product_type;
create view jos_vm_product_type_1 as select * from installation1_joomla.jos_vm_product_type_1;
create view jos_vm_product_type_parameter as select * from installation1_joomla.jos_vm_product_type_parameter;
create view jos_vm_product_votes as select * from installation1_joomla.jos_vm_product_votes;
create view jos_vm_shipping_carrier as select * from installation1_joomla.jos_vm_shipping_carrier;
create view jos_vm_shipping_label as select * from installation1_joomla.jos_vm_shipping_label;
create view jos_vm_shipping_rate as select * from installation1_joomla.jos_vm_shipping_rate;
create view jos_vm_shopper_group as select * from installation1_joomla.jos_vm_shopper_group;
create view jos_vm_shopper_vendor_xref as select * from installation1_joomla.jos_vm_shopper_vendor_xref;
create view jos_vm_state as select * from installation1_joomla.jos_vm_state;
create view jos_vm_tax_rate as select * from installation1_joomla.jos_vm_tax_rate;
create view jos_vm_userfield as select * from installation1_joomla.jos_vm_userfield;
create view jos_vm_userfield_values as select * from installation1_joomla.jos_vm_userfield_values;
create view jos_vm_user_info as select * from installation1_joomla.jos_vm_user_info;
/*create view jos_vm_vendor as select * from installation1_joomla.jos_vm_vendor;*/
create view jos_vm_vendor_category as select * from installation1_joomla.jos_vm_vendor_category;
create view jos_vm_waiting_list as select * from installation1_joomla.jos_vm_waiting_list;
create view jos_vm_zone_shipping as select * from installation1_joomla.jos_vm_zone_shipping;
	CREATE VIEW jos_users AS SELECT * FROM installation1_joomla.jos_users;
	CREATE VIEW jos_session AS SELECT * FROM installation1_joomla.jos_session;
	CREATE VIEW jos_stats_agents AS SELECT * FROM installation1_joomla.jos_stats_agents;
	CREATE VIEW jos_core_acl_aro AS SELECT * FROM installation1_joomla.jos_core_acl_aro;
	CREATE VIEW jos_core_acl_aro_groups AS SELECT * FROM installation1_joomla.jos_core_acl_aro_groups;
	CREATE VIEW jos_core_acl_aro_map AS SELECT * FROM installation1_joomla.jos_core_acl_aro_map;
	CREATE VIEW jos_core_acl_aro_sections AS SELECT * FROM installation1_joomla.jos_core_acl_aro_sections;
	CREATE VIEW jos_core_acl_groups_aro_map AS SELECT * FROM installation1_joomla.jos_core_acl_groups_aro_map;
DROP TABLE jos_acymailing_config  ;
DROP TABLE 	jos_acymailing_fields ; 
DROP TABLE 	jos_acymailing_filter; 
DROP TABLE 	jos_acymailing_list ;
DROP TABLE 	jos_acymailing_listcampaign;
DROP TABLE 	jos_acymailing_listmail ;
DROP TABLE 	jos_acymailing_listsub 	;
DROP TABLE 	jos_acymailing_mail 	;
DROP TABLE 	jos_acymailing_queue 	;
DROP TABLE 	jos_acymailing_stats 	;
DROP TABLE 	jos_acymailing_subscriber;
DROP TABLE 	jos_acymailing_template; 
DROP TABLE 	jos_acymailing_url 	;
DROP TABLE 	jos_acymailing_urlclick; 
DROP TABLE 	jos_acymailing_userstats;

create view jos_acymailing_config  as select * from installation1_joomla.jos_acymailing_config;
create view jos_acymailing_fields as select * from installation1_joomla.jos_acymailing_fields; 
create view jos_acymailing_filter as select * from installation1_joomla.jos_acymailing_filter; 
create view jos_acymailing_list as select * from installation1_joomla.jos_acymailing_list;
create view jos_acymailing_listcampaign as select * from installation1_joomla.jos_acymailing_listcampaign;
create view jos_acymailing_listmail as select * from installation1_joomla.jos_acymailing_listmail;
create view jos_acymailing_listsub 	as select * from installation1_joomla.jos_acymailing_listsub;
create view jos_acymailing_mail 	as select * from installation1_joomla.jos_acymailing_mail;
create view jos_acymailing_queue 	as select * from installation1_joomla.jos_acymailing_queue;
create view jos_acymailing_stats 	as select * from installation1_joomla.jos_acymailing_stats;
create view jos_acymailing_subscriber as select * from installation1_joomla.jos_acymailing_subscriber;
create view jos_acymailing_template as select * from installation1_joomla.jos_acymailing_template; 
create view jos_acymailing_url 	as select * from installation1_joomla.jos_acymailing_url;
create view jos_acymailing_urlclick as select * from installation1_joomla.jos_acymailing_urlclick; 
create view jos_acymailing_userstats as select * from installation1_joomla.jos_acymailing_userstats;
DROP TABLE jos_content  ;
DROP TABLE jos_content_frontpage	;
create view jos_content  as select * from installation1_joomla.jos_content;
create view jos_content_frontpage  as select * from installation1_joomla.jos_content_frontpage;	
DROP TABLE 	jos_languages 	 ;
DROP TABLE 		jos_menu  ;
DROP TABLE 		jos_menu_types;
DROP TABLE 		jos_categories;
DROP TABLE 		jos_sections;
DROP TABLE 		jos_jf_content;
DROP TABLE 		jos_jf_tableinfo;

create view	jos_languages 	as select * from installation1_joomla.jos_languages;
create view	jos_menu as select * from installation1_joomla.jos_menu;
create view		jos_menu_types as select * from installation1_joomla.jos_menu_types;
create view		jos_categories as select * from installation1_joomla.jos_categories;
create view		jos_sections as select * from installation1_joomla.jos_sections;
create view 		jos_jf_content as select * from installation1_joomla.jos_jf_content;
create view		jos_jf_tableinfo as select * from installation1_joomla.jos_jf_tableinfo;
Where installation1 is the main ddbb and installation2 the ddbb that will look for data in installation1. The first online road cycling magazine in spanish



Return to “Core Hacks and Patches”