Recent Posts

Pages: 1 ... 8 9 [10]
91
How-to questions / Re: INSERT Login Data Into Multiple Databases?
« Last post by Basara on September 29, 2020, 01:52:19 AM »
Hello.

This is AbanteCart forum. Your code is for another application
92
How-to questions / INSERT Login Data Into Multiple Databases?
« Last post by Chris Pine on September 29, 2020, 12:02:44 AM »
Is there a way to 'INSERT' multiple user registrations into the database xf_user so my customers have the ability to login?

I've looked at doing something like:

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}
} else {

$sql = "INSERT INTO MyGuests (firstname, lastname, email)
VALUES ('John', 'Doe', 'email');";
$sql .= "INSERT INTO MyGuests (firstname, lastname, email)
VALUES ('Mary', 'Moe', 'email');";
$sql .= "INSERT INTO MyGuests (firstname, lastname, email)
VALUES ('Julie', 'Dooley', 'email')";

if ($conn->multi_query($sql) === TRUE) {
  echo "New records created successfully";
} else {
  echo "Error: " . $sql . "<br>" . $conn->error;
}

public static function createUser($sUsername, $sEmail, $sPassword, array $aAdditionalData = array()) {

//Create the username from the person's name:
$sUsername = str_replace(' ', "_", $sUsername);

//Set User Data
$cWriter = XenForo_DataWriter::create('XenForo_DataWriter_User');
$cWriter->set('username', $sUsername);
$cWriter->set('email', $sEmail);
$cWriter->setPassword($sPassword);
$cWriter->set('user_group_id', XenForo_Model_User::$defaultRegisteredGroupId);
$cWriter->set('user_state', 'valid');

//echo"<pre>";print_r($cWriter);

foreach ($aAdditionalData AS $data => $key) {
$cWriter->set($data, $key);
}
$cWriter->save();
$cUser = $cWriter->getMergedData();

//Login new user: Log the ip of the user registering
XenForo_Model_Ip::log($cUser['user_id'], 'user', $cUser['user_id'], 'register');
//Set the user back to the browser session
XenForo_Application::get('session')->changeUserId($cUser['user_id']);
XenForo_Visitor::setup($cUser['user_id']);

return $cUser['user_id'];
}

/*
* Get the current user:
*/

public static function getCurrentUser() {

XenForo_Session::startPublicSession();
$cVisitor = XenForo_Visitor::getInstance();
if ($cVisitor->getUserId()) {
$dbUserModel = XenForo_Model::create('XenForo_Model_User');
$cUserInfo = $dbUserModel->getFullUserById($cVisitor->getUserId());
}
return $cUserInfo;
}

/*
* Get the current user:
*/

public static function getUserByEmail($sEmail) {
$dbUserModel = XenForo_Model::create('XenForo_Model_User');
$cUser = $dbUserModel->getUserByEmail($sEmail, array('join' => XenForo_Model_User::FETCH_USER_PROFILE + XenForo_Model_User::FETCH_LAST_ACTIVITY));
return $cUser;
}

/*
* Set the user state: from email_confirm to valid.
*/

public static function setUserState($iXFID, $sState) {
//'valid'
//'email_confirm'
//query("UPDATE xf_user SET user_state = ? WHERE user_id = ? LIMIT 1", array($sState, $iXFID));
}

/*
* Login a XenForo User // Set the cookie.
*/

public static function login($sEmail, $sPassword, $bRemember = true) {

//Get this class; delete existing login information
error_reporting(E_ALL);
restore_error_handler();
restore_exception_handler();

$dbLoginModel = XenForo_Model::create('XenForo_Model_Login');
$dbUserModel = XenForo_Model::create('XenForo_Model_User');
$sError = "";

$iUserID = $dbUserModel->validateAuthentication($sEmail, $sPassword, $sError);
if (!$iUserID) {
$dbLoginModel->logLoginAttempt($sEmail);
return $sError;
}

$dbLoginModel->clearLoginAttempts($sEmail);

if ($bRemember) {
$dbUserModel->setUserRememberCookie($iUserID);
}

XenForo_Model_Ip::log($iUserID, 'user', $iUserID, 'login');

$dbUserModel->deleteSessionActivity(0, $_SERVER['REMOTE_ADDR']);

$cSession = XenForo_Application::get('session');
$cSession->changeUserId($iUserID);
XenForo_Visitor::setup($iUserID);

return $iUserID;
}

/*
* Set this user ID as logged in.
*/

public static function setLogin($iUserID) {
$dbUserModel = XenForo_Model::create('XenForo_Model_User');
$dbUserModel->setUserRememberCookie($iUserID);
XenForo_Model_Ip::log($iUserID, 'user', $iUserID, 'login');
$dbUserModel->deleteSessionActivity(0, $_SERVER['REMOTE_ADDR']);
$cSession = XenForo_Application::get('session');
$cSession->changeUserId($iUserID);
XenForo_Visitor::setup($iUserID);
}

/*
* Check if this user name is in use, return true for already exists.
*/

public static function bUsernameInUse($sUsername) {

$db = XenForo_Application::get('db');

$cUser = $db->fetchRow("SELECT * FROM xf_user WHERE `username` = '$sUsername' LIMIT 1");

if (is_numeric($cUser['user_id'])) {
return true;
} else {
return false;
}
}






Have I missed anything? I cannot figure out how to get multiple databases and login systems to pull off of or store information in each others database. For Example. Login to website one with own db causes an insert of username and password stored into my xf database user and password and makes checks on login whether that username and password are valid and a cookie has been set so within the req timeframe you would be logged in on both websites login systems due to website universal cookie. I know it's possible and I think many of us here are close but could anyone lend a hand here? Thanks so much!
93
Extension Support / Re: No shipping options available error
« Last post by llegrand on September 27, 2020, 09:04:48 PM »
have you changed your settings within the USPS extension recently?

We find if we set the package dims within the settings page not the product page,  and turn on ONLY the Parcel Post,  we get a rate.

Note that the calculation will always be done on the settings size and not the products page.  Unless you only have one size of packaging  this may be a negative for you.

 
94
General Support / Re: Latest Products on home page
« Last post by ashtonm on September 27, 2020, 04:03:06 PM »
Thank you Basara.

I will check that out.

Mike
95
Extension Support / Re: No shipping options available error
« Last post by llegrand on September 25, 2020, 07:44:53 PM »
You don't sound ungrateful,  no worries. 

We are WHY2 in the MarketPlace and we have several shipper extensions including  USPS enhanced -  so we always try to look into any shipping posts to see if there an issue we need to be aware of or if we can assist even on the default shippers.

The slowness you indicated is not something any of our users have reported nor do we see any thing we are testing  for updates etc. 

If you ONLY have one service enabled in your settings on the USPS extension,  that should be the only thing that is passed to the rate lookup.   We will do a little testing (might be a day or two)  and report our findings so we can help you isolate where the issue is.  If you find out anything from USPS  please share.

Lee
96
Extension Support / Re: No shipping options available error
« Last post by pilgrim on September 25, 2020, 07:14:38 PM »
It all worked fine until recently. This doesn't have anything to do with alaska. I'm on the west coast, and the API results will not show for retail ground on the west coast within my zone. This may not be the case if the API request would be for class id 4 retail ground only. <Postage CLASSID="4"><MailService>USPS Retail Ground</MailService>. The API request is for "ALL" -    <Service>ALL</Service>, even though i have only parcel post selected in the USPS extension.
I'm not sure this will fix it, but it might. I have a trouble ticket in with the USPS to see what they say, but the initial CS agent thought there was something wrong on the USPS end. The USPS rate server has always been touchy, slow and sometimes does not even work, and it has been that way for a long time, but this is something new. It just seems to me that the checkout process that sends the API to the USPS rate server should be requesting only the one service and not "ALL". If there is a way to force the checkout process to requesting the one service, i will do that, but i do not know how.
Anyway thank you for your help, i do not want to come off as ungrateful, because i am grateful for the help.
97
Extension Support / Re: No shipping options available error
« Last post by llegrand on September 25, 2020, 04:44:31 PM »
In looking at the USPS most current info  I find this:

 
    USPS Retail Ground—LOR retail prices are only available for items mailed within the state of Alaska for pieces delivered to or from the eligible intra-Alaska ZIP Codes in DMM Exhibit 150.1.3.
    USPS Retail Ground—LOR retail prices are not available through online or commercial postage payment.
    For parcels that measure in combined length and girth more than 84 inches but not more than 108 inches, and the piece weighs less than 20 pounds, use the 20-pound price (balloon price) based on the applicable zone.
    For parcels that measure in combined length and girth more than 108 inches but not more than 130 inches, use the oversized price, regardless of weight, based on the applicable zone.


Are you shipping Alaska?  or what zip is causing your stated =  problem is when the origin and destination zones are the same

There is also this for non LOR
    Zones 1–4 are only for the mailing of hazardous materials, live animals, or other items required to be shipped by ground transportation (does not apply to oversized parcels).
    Parcels that exceed one cubic foot (1,728 cubic inches) are charged based on the actual weight or the dimensional weight, whichever is greater (as calculated in DMM 153.1.4).
    For parcels that measure in combined length and girth more than 108 inches but not more than 130 inches, use the oversized price, regardless of weight, based on the applicable zone.



98
Extension Support / Re: No shipping options available error
« Last post by pilgrim on September 25, 2020, 01:09:57 PM »
Retail ground(parcel select). AbanteCart cart is the latest version, i just checked for updates, says it is up to date.
99
Support / Re: Category Error and URL not found
« Last post by enjoytomove on September 25, 2020, 10:55:29 AM »
Update:

after making the suggested change, I now have two problems...

before, by clicking on a sold out product, you could still see the technical sheet.
Now, the page refreshes and takes you to the home page.

Second problem...

before editing, by clicking on the main category, compare all the products I had selected...
Now,if I select the main category...i just get a refresh 


:(
100
General Support / Re: Latest Products on home page
« Last post by Basara on September 25, 2020, 03:24:44 AM »
You have to clear AbanteCart cache in admin if you directly edit database
Pages: 1 ... 8 9 [10]

Powered by SMFPacks Social Login Mod