Forum Replies Created

Viewing 15 replies - 16 through 30 (of 36 total)
  • Plugin Author Richard Feraro

    (@richardferaro)

    The script I posted will not produce a visible output on-screen. Instead, it will generate a cookie named ‘frontend‘ which tells you that Magento session is running. To double check using the first script if it is working, add the code below which will display an array of classes that has been successfully instantiated. It should include Mage and Varien in the list. If it doesn’t, there must be a fatal error somewhere. Add error_reporting(E_ALL); at the top most part of the file to display any error.

    <?php
    print_r(get_declared_classes());
    ?>

    Regarding your second script, if your session was started from Magento then you opened WordPress, they won’t share the same session because it uses cookies to authenticate users which in your case, they’re on a different cookie path. It’s similar with what Barry experienced in his comment. To overcome this, you must pass the SID to be used by the PHP session in WP page or vice-versa.

    You’re script doesn’t contain the login method. Try this instead (take note of the login part, replace it with your test account):

    <?php if(class_exists('Mage')){
    	Mage::getSingleton('core/session', array('name' => 'frontend'));
    	}
    
    if(class_exists('Mage')){
    	$session = Mage::getSingleton("customer/session");
    	// Add customer credentials here
    	$session->login('email', 'password');
    
    	$magento_message = "Welcome ";
    	// Generate a personalize greeting
    	if($session->isLoggedIn()){
    		$magento_message .= $session->getCustomer()->getData('firstname').' ';
    		$magento_message .= $session->getCustomer()->getData('lastname').'!';
    	}else{
    		$magento_message .= "Guest!";
    	}
    
    	echo $magento_message;
    }
    ?>
    Plugin Author Richard Feraro

    (@richardferaro)

    That’s a configuration issue in either of the two setups you have. Double check if the Safe Mode setting is really turned off to allow you to access the file. A phpinfo(); will do the trick.

    Plugin Author Richard Feraro

    (@richardferaro)

    What happens when you run the code below in a separate file within /var/www/vhosts/dialoguebooks.org/subdomains/dev/httpdocs/

    <?php
        require_once ( "/var/www/vhosts/secure.dialoguebooks.org/httpdocs/app/Mage.php" );
        Mage::app("default");
        Mage::getSingleton("core/session", array("name" => "frontend"));
    ?>

    The idea is that Mage.php must be accessible locally.

    Plugin Author Richard Feraro

    (@richardferaro)

    Create a file in httpdocs and run the code below. Add your Magento address to Mage.php and use it as your Mage.php URL.

    <?php echo $_SERVER['DOCUMENT_ROOT']; ?>

    Plugin Author Richard Feraro

    (@richardferaro)

    You’re welcome David. Thanks for the feedback.

    Plugin Author Richard Feraro

    (@richardferaro)

    This has been fixed in version 1.2.2 of the plugin

    Plugin Author Richard Feraro

    (@richardferaro)

    Hello David! Thanks for the feedback. We’re you able to record the URL of the stylesheet before and after you did the editing? I don’t have MAMP but I’ll try to install one this week to see it for myself ??

    Plugin Author Richard Feraro

    (@richardferaro)

    After you activated the plugin and provided the right absolute path to your Mage.php, add the following lines somewhere in your code where there is no header being sent:

    if(class_exists('Mage')){
        $status = Mage::getModel('newsletter/subscriber')->subscribe('[email protected]');
        $message = ($status == 1) ? "Success" : "Fail";
    }

    or else you’ll get an error similar below:

    Fatal error: Uncaught exception ‘Exception’ with message ‘Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at C:\xampp\htdocs\wordpress-3.0\wp-content\themes\twentyten\header.php:12) in C:\xampp\htdocs\magento\app\code\local\Mage\Core\Model\Session\Abstract\Varien.php on line 115′ in C:\xampp\htdocs\magento\app\code\local\Mage\Core\functions.php:247 Stack trace: #0 [internal function]: mageCoreErrorHandler(2, ‘session_start()…’, ‘C:\xampp\htdocs…’, 115, Array) #1 C:\xampp\htdocs\magento\app\code\local\Mage\Core\Model\Session\Abstract\Varien.php(115): session_start() #2 C:\xampp\htdocs\magento\app\code\local\Mage\Core\Model\Session\Abstract\Varien.php(155): Mage_Core_Model_Session_Abstract_Varien->start(NULL) #3 C:\xampp\htdocs\magento\app\code\core\Mage\Core\Model\Session\Abstract.php(84): Mage_Core_Model_Session_Abstract_Varien->init(‘customer_base’, NULL) #4 C:\xampp\htdocs\magento\app\code\core\Mage\Cust in C:\xampp\htdocs\magento\app\code\local\Mage\Core\functions.php on line 247

    Forum: Plugins
    In reply to: Mage Enabler and MAMP

    Added examples in the latest version.

    Plugin Author Richard Feraro

    (@richardferaro)

    @c_turnbull: This has been fixed in Mage Enabler 1.2 version

    Plugin Author Richard Feraro

    (@richardferaro)

    I’m just wondering, is it a good practice to remove the ‘default’ store view code and change it to whatever code you want when in fact you do really need a default config on settings that relies to a global/default reference?

    PS: I’ve never seen a plugin that “…burn” like c_turnbull mentioned

    Plugin Author Richard Feraro

    (@richardferaro)

    I’ve checked the file that triggers your error.
    D:\wamp\www\leborsedisilvia\shop\app\code\core\Mage\Core\Model\App.php

    It seems there’s a problem in your store code setup because it says you have an empty store code. The code below is where you’re having a problem (line #760):

    if (empty($this->_stores[$id])) {
    	$store = Mage::getModel('core/store');
    	/* @var $store Mage_Core_Model_Store */
    	if (is_numeric($id)) {
    		$store->load($id);
    	} elseif (is_string($id)) {
    		$store->load($id, 'code');
    	}
    
    	if (!$store->getCode()) {
    		$this->throwStoreException();
    	}
    	$this->_stores[$store->getStoreId()] = $store;
    	$this->_stores[$store->getCode()] = $store;
    }

    You have to fix it first. Mage Enabler requires a WORKING Magento setup.

    Plugin Author Richard Feraro

    (@richardferaro)

    Actually I’m also eager to know if there are live (production) site with this plugin installed. With that number of downloads, I’m sure someone does.

    Plugin Author Richard Feraro

    (@richardferaro)

    You didn’t include your home/root directory

    Sample:

    if magento is installed in your webroot or public_html
    /home/richardferaroserver/public_html/app/Mage.php

    or

    if magento is one directory (magento) up
    /home/richardferaroserver/public_html/magento/app/Mage.php

    Plugin Author Richard Feraro

    (@richardferaro)

    Yes. But you have to do the actual script within WordPress together with this plugin. Sample scripts are available online.

Viewing 15 replies - 16 through 30 (of 36 total)