Getting Magento user session values in joomla - session

In my site i have joomla 1.6 and magento 1.5, i would like to get the magento logged user session values in joomla to show as logged in .....
i have tried the following code :
'frontend'));
$session = Mage::getSingleton('customer/session', array('name'=>'frontend'));
print_r($session);
echo Mage::getSingleton('customer/session')->getCustomer()->getEmail();
echo Mage::helper('customer')->getCustomerName();
?>
But im getting empty values
Note : Sometimes i may get the customer details , if i tried to test the answer like delete the browser cookies and delete cache in magento ,again log in , it results as empty array

It's not that simple. Being logged in implies that there is an associated user account that you are logging in to. You will have all kinds of problems is you have a user register for an account in one system but not the other. What you need is a bridge that syncs the user account across both systems and provides a unified login.
http://extensions.joomla.org/extensions/e-commerce/e-commerce-bridges/9440

Related

Magento 2: My Headless Magento catalog with guest cart to redirect to magento vanila checkout page but need to know how to transfer session

Hi I have created a reactjs single page catalog using Rest API and we still have live magento 2.1 website running in vanilla mode.
Our live vanilla website support all required payment modes and therefore want my react web app to redirect checkout on live magento website.
I have successfully build the react app which can add products in cart and view cart using quoteID and Quote Mask ID. Now I need to know like vanila Magento can I set some session or cookies and then redirect user to live Magento website checkout page.
Now I have failed to understand how magento vanila frontend identifies guest user pulls exact cart items on their default cart page. what exactly are they storing in cookie or localstorage of the browser that they are able to map to the quote id in the backend.
If someone can direct me will be great. I have already looked into Quote table, Quote_items table and vistor table too but did not find any link to PHPSESSIONID. Now I doubt whether they even rely on it.
www.example.com is my live website
and webapp.example.com is my PWA/ReactJS based which consumes Magento's Web api.
public function __construct
(
\Magento\Framework\Session\SessionManager $sessionManager
)
{
$this->_session = $sessionManager;
}
public function execute(\Magento\Framework\Event\Observer $observer)
{
$sessionID = $this->_session->getSessionId();
}
URL: https://www.example.com?SID=sessionid
Example: https://www.example.com?SID=v32hjtpgt8e12jorc0tksekkj6
Magento store sessionid at cookie and session data at server which location is define in env.php

Getting current Prestashop user in external site

In order for me to get a Prestashop user's cart, I first need to know who the user is in my external CodeIgniter application.
I have tried various attempts like the following: http://www.prestashop.com/forums/topic/204227-webservice-and-check-if-user-is-logged-in/ and http://www.prestashop.com/forums/topic/156218-solvedish-integrating-prestashop-into-a-pre-developed-website/ and even Prestashop: Session cookies & login and http://webilyst.com/prestashop-cookie-structure/
But I could not get it working. For some reason, the moment I include config.inc.php, it redirects to the shop - instead of allowing me to get the ID required.
My question: Any idea how to get this current user ID from PrestaShop in external epplication?
Edit 1
I am using CI 2.1.4 and PrestaShop 1.5.6.x.
Edit 2 Seems like the articles I have read is for an older version of PS. That code actually gets to a point where the Shop is being initialized, and once that is done, in Shop.php, the user is redirected to the shop. I do not want this to happen - I just want to find out who the current logged in user is.
You can get the current customer ID with the following code:
include($prestashopBasePath . '/config/config.inc.php');
$context = Context::getContext();
$customerId = $context->customer->id;
The reason why you are redirected is that you execute the script from a URL that is different from the shop URL defined in back-office -> Preferences -> Set shop URL. For example the shop URL is example.com/presta and your script is in example.com/other/script.php.
The solution is to move your script to the PrestaShop directory.

How can registered user can create a new article from joomla front-end in 2.5?

How to create a new article from joomla front-end by registered user. I tried a lot but i cant solves the problem.
Only super user can create a new article.
I create a new menu called create article in main menu and its access is gives to registered. But i still got the error
An error has occurred.
The requested page cannot be found.
Home Page
If difficulties persist, please contact the System Administrator of this site and report the error below.
403 You are not authorised to view this resource.
when i will try to create a new article by registered user from front-end.
Please help me for this.
Thanx in advance...
By default registered users do not have create rights, you need to be an author for that.
You can do what you want in two ways, change the permission for Registered in com_content for Create to Allowed or you could change the default user group for new users to Author. YOu set the default group in the user manager options.
The working of user role in joomla is something like this:
$user =& JFactory::getUser();
//print_r($user);
//echo $user->get('gid');
if($user->get('gid') == 25 ){
//allow user
} else{
//disallow or redirect to somewhere
}
The above code allows for user group 25 only.
What you need to do is:
Find the code for registered user and include the user group code in if condition.
Note: You can find the user group code from jos_users table.

Joomla registration error

In the website http://www.ple-intl.com/NewUpgrade, I am using joomla 2.5 & getting an below error during registration
It registered the user but, does not send the activation link, however it is set as a self in user options.
when user click on register after filling form it shows an 404 error. (personally i dont change any thing core, & i dont want to but i am getting an error i checked all the things)
Some Plugin Information
I installed virtue mart in it, but every thing is defualt
I am user Super Login Module for login registration which calls the default joomla signup page.
Kindly guide what i am missing..I am tired to sort that out but none of my idea works.
Thanks it start working now, below i have mentioned the reason why it showing error.
The email i was inserted is actually registered before & when i remove that id i did'not remove the product related to it in virtue mart.
second virtue mart registration activation link which send in email has some problems, on the below link solution is discussed.
http://forum.virtuemart.net/index.php?topic=99755.0

Protect joomla article with password

I have a joomla 1.5.21 website for a friend, he created a selling page for a program...and he wants to protect the page of the program , and send the password to everyone who purchases it.
So I've downloaded the contentPassword Plugin, and put the code : {password pass="123"} in the page I want protect.
When entering the page..the page asks me to enter password, but when I insert password, (123) it doesn't open the page.
My question is : is there someone whose familiar with this plugin? or is there any other better method that will save me more time?
thank you in advance
You could try Mighty Membership. It limits access to articles, modules, components etc. Users can pay for a subscription which will allow them access to a specific article. You can also limit the amount of times they can view the page, so once they've paid, they can view the page once to download the software then it will be restricted again.
I've just used this to make a basic subscription only video site and it's pretty good.
Sadly it's not free though.
I really don't like to install plugins if it's not necessary. In your case I would add to the beginning of the article the following php code:
<?php
$protect = $_GET['prot'];
if ($protect != 'xR5dL0Nj76H'){
//get out of here if you don't send the correct GET parameter...
header('Location: http://www.google.com/');
}
//echo "logged in successfully!";
?>
and of course you'll have to send the users to the article with the GET parameter: &prot=xR5dL0Nj76H (its equivalent to have a shared password to all the users - like you describe)

Resources