cb+virtuemart ???

15 years 8 months ago #69453 by kubbah
Replied by kubbah on topic Re:cb+virtuemart ???
sorry.. I'm just a user... not a developer :P

so if I install the CB 1.2 RC2, after installing virtuemart... I should make the same fields as virtuemart has?

and If I create the same fields, virtuemart will assign the to the profile all card staff and so on?

you think this could be a solution? thnx

Please Log in to join the conversation.

15 years 8 months ago #69455 by beat
Replied by beat on topic Re:cb+virtuemart ???
Nope, sorry, won't work without some development (not minor development).

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info

Please Log in to join the conversation.

15 years 8 months ago #69467 by kubbah
Replied by kubbah on topic Re:cb+virtuemart ???
thnx for replying

I know you are working on cb 1.2 stable version...
and after that you will work on this integration??
you know.. cb and vm are so popular.. I think they should work together...
a lot of people could pay for thay... :)

could you say us about the time?
or we better should search for the alternative solution?

Please Log in to join the conversation.

15 years 8 months ago #69484 by beat
Replied by beat on topic Re:cb+virtuemart ???
Honestly, with CB and all plugins and other goodies in the works and upcoming around it, I'm unfortunately really fully booked for the months to come.

I would be happy to help the virtuemart core dev team to integrate smoothly with CB, by helping designing a solution, but won't have time implementing it myself in the next monhts at very least.

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info

Please Log in to join the conversation.

15 years 8 months ago #71014 by gmanish
Replied by gmanish on topic Re:cb+virtuemart ???
My site configuration is J1.5.5, CB12RC2 and VM1.1.2, PHPBB3.0.2., rokbridge RC5beta2
I am using cb_login module instead of Joomla login and CB is primary method of registeration on my site.

However since I want customers on my site to be able to browse store and place items in cart without first asking them to register I end up with accounts created in joomla and not in CB, if such new users decide to proceed with checkout.

As we know Virtuemart currently does not integrate with CB (or vice versa ) I was ending up having users created in jos_users without them getting synched with jos_comprofiler.

Here is how I went about tackling this problem.

I created a trigger on my jos_users table as below:

**********************************************************************
DELIMITER $$
DROP TRIGGER /*!50032 IF EXISTS */ `yourdb`.`sync_cb`$$
create trigger `yourdb`.`sync_cb` BEFORE UPDATE on `yourdb`.`jos_users`
for each row BEGIN
DECLARE MY_PHONE VARCHAR(64) ;
DECLARE MY_ADD VARCHAR(64) ;
DECLARE MY_CITY VARCHAR(64) ;
DECLARE MY_STATE_2_CODE VARCHAR(64) ;
DECLARE MY_STATE VARCHAR(64) ;
DECLARE MY_COUNTRY_3_CODE VARCHAR(64) ;
DECLARE MY_COUNTRY_ID INT(11) ;
DECLARE MY_COUNTRY VARCHAR(64) ;
DECLARE MY_ZIP VARCHAR(64) ;

IF OLD.activation <> NEW.activation Then
IF not exists (select * from jos_comprofiler where jos_comprofiler.id = NEW.id) Then
SELECT phone_1, concat(address_1, ', ', address_2), city, state, country, zip INTO MY_PHONE, MY_ADD, MY_CITY, MY_STATE_2_CODE, MY_COUNTRY_3_CODE, MY_ZIP
FROM jos_vm_user_info
WHERE user_id = NEW.id
AND address_type = 'BT';

SELECT country_id, country_name INTO MY_COUNTRY_ID, MY_COUNTRY
FROM jos_vm_country
WHERE country_3_code = MY_COUNTRY_3_CODE;

SELECT state_name INTO MY_STATE
FROM jos_vm_state
WHERE state_2_code = MY_STATE_2_CODE
AND country_id = MY_COUNTRY_ID;

INSERT INTO jos_comprofiler (id, user_id, avatarapproved, approved, confirmed, rc_phone,rc_address, rc_city, rc_state, rc_country, rc_zipcode) VALUES (NEW.id, NEW.id, 1, 1, 1, MY_PHONE, MY_ADD, MY_CITY, MY_STATE, MY_COUNTRY, MY_ZIP);

END IF;
END IF;
END;
$$
DELIMITER ;

**********************************************************************
The assumption is that when the user activates the account the jos_users.activation field becomes blank and that is the opportunity to insert record in jos_comprofiler. Please note that I also have some Address related fields in my CB and hence I am just copying those values from the VM tables as user has already provided that information. Please modify the fields assignments and names as per your settings.


The next thing I am looking to do is to create a similar trigger on jos_comprofiler so I may sync/populate the info in VM tables whenever a new user creates or updates their account from CB.

M

Please Log in to join the conversation.

15 years 8 months ago #71027 by gmanish
Replied by gmanish on topic Re:cb+virtuemart ???
I have created another trigger that creates a Virtuemart Bill To Address from CB profile.
Here is the code:

***********************************************
DELIMITER $$

DROP TRIGGER /*!50032 IF EXISTS */ `yourdb`.`sync_vm`$$

create trigger `yourdb`.`sync_vm` AFTER INSERT on `yourdb`.`jos_comprofiler`
for each row BEGIN

DECLARE MY_FNAME VARCHAR(64) ;
DECLARE MY_LNAME VARCHAR(64) ;
DECLARE MY_EMAIL VARCHAR(64) ;
DECLARE MY_STATE_2_CODE VARCHAR(64) ;
DECLARE MY_COUNTRY_3_CODE VARCHAR(64) ;
DECLARE MY_COUNTRY_ID INT(11) ;


IF not exists (SELECT * FROM jos_vm_user_info WHERE user_id = NEW.id AND address_type = 'BT') Then

SELECT substring_index(name,' ',1), substring_index(name,' ',-1), email INTO MY_FNAME, MY_LNAME, MY_EMAIL
from jos_users where id = NEW.id;

SELECT country_3_code, country_id INTO MY_COUNTRY_3_CODE, MY_COUNTRY_ID
FROM jos_vm_country
WHERE country_name = NEW.rc_country;

SELECT state_2_code INTO MY_STATE_2_CODE
FROM jos_vm_state
WHERE state_name = NEW.rc_state;
/*AND country_id = MY_COUNTRY_ID;*/

INSERT INTO jos_vm_user_info (user_info_id, user_id, address_type, address_type_name, last_name, first_name, phone_1, address_1, city, state, country, zip, user_email, perms) VALUES (concat('fromcb-', NEW.user_id), NEW.user_id, 'BT', '-default-', MY_LNAME, MY_FNAME, NEW.rc_phone, NEW.rc_address, NEW.rc_city, MY_STATE_2_CODE, MY_COUNTRY_3_CODE, NEW.rc_zipcode, MY_EMAIL, 'shopper');

END IF;
END;
$$

DELIMITER ;

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.181 seconds

Facebook Twitter LinkedIn