hi there, i just installed mijoshop and CB and would like to auto add the address fields from the registration of CB to the address fields of mijoshop. it adds the user etc but not address or other extra fields.
here is my code in auto action. (sorry, not that good with code)
Code:
$myuserid = SELECT MAX( user_id ) FROM `#__comprofiler`;
$address = SELECT `cb_address` FROM `#__comprofiler` where `user_id` = '$mysuerid';
$addressid = SELECT MAX( customer_id ) FROM `#__mijoshop_address`;
UPDATE #__mijoshop_address SET `address_1` = '$address' where `customer_id` = '$addressid';
joomla 2.5.9 cb 1.9
also attached a screenshot of the auto action plugin.
You write the queries in the same way you would if you were using them in phpmyadmin with the exception that instead of your table prefix you use #__ and that substitutions can be used as well (e.g. `user_id` = '[user_id]').
The below will probably work. Am not familiar with that extensions database and is purely based off what you have already provided and am guessing customer id within your extension is user id (the ID as seen in _users and _comprofuler).
Code:
UPDATE `#__mijoshop_address` SET `address_1` = '[cb_address]' WHERE `customer_id` = '[user_id]'
Note the above is just an update query. If the row doesn't exist it won't do anything.
Kyle (Krileon) Community Builder Team Member Before posting on forums:
Read FAQ thoroughly
+
Read our Documentation
+
Search the forums CB links:
Documentation
-
Localization
-
CB Quickstart
-
CB Paid Subscriptions
-
Add-Ons
-
Forge
-- If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
-- If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please
send me a private message
with your thread and will reply when possible!
-- Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
-- My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
That's not correct again. Why are you using a select query for user id? That's just going to pull the last user row in your database and not the current user row. Please see my above reply. You should be doing the below.
WHERE `user_id` = '[user_id]'
In your usage if you had 2 people register at the same time then 1 would not working. Please ensure you're using the above so it is absolutely specific to their user id.
Kyle (Krileon) Community Builder Team Member Before posting on forums:
Read FAQ thoroughly
+
Read our Documentation
+
Search the forums CB links:
Documentation
-
Localization
-
CB Quickstart
-
CB Paid Subscriptions
-
Add-Ons
-
Forge
-- If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
-- If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please
send me a private message
with your thread and will reply when possible!
-- Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
-- My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.