Posted by nick on May 5, 2012 at 8:00 am
I was able to get a recaptcha working on my Zend Framwork application, but as soon as I added the “‘ssl’ => true” to my zend_form, the captcha disappeared. Here is the code used in zend_form:
//captcha
$this->addElement('captcha', 'captcha', array(
'label' => 'Please Type:',
'required' => true,
'captcha' => array(
'pubkey' => RECAPTCHA_PUBLIC_KEY,
'privkey' => RECAPTCHA_PRIVATE_KEY,
'captcha' => 'reCaptcha',
'ssl' => true
)
));
The reason ssl didn’t work with recaptcha is because the secure URL was out of date in my zend framework library. To update, open /Zend/Service/ReCaptcha.php and update the server constants at the top to
/**
* URI to the regular API
*
* @var string
*/
const API_SERVER = 'http://www.google.com/recaptcha/api';
/**
* URI to the secure API
*
* @var string
*/
const API_SECURE_SERVER = 'https://www.google.com/recaptcha/api';
/**
* URI to the verify server
*
* @var string
*/
const VERIFY_SERVER = 'http://www.google.com/recaptcha/api/verify';
Continue Reading
Posted by nick on March 22, 2012 at 12:47 pm
I wanted to move magento’s var and media directories outside of the core code base so I wouldn’t have to put them in version control. It would make updating the live web server much easier since the dynamic content of these two directories could remain in place while a new branch of the code was checked out and put along side it. First I created a directory named “common” along side the magento directory and moved the var and media directories inside this one. On my local setup, I created a new virtual host for this directory and added www.common.localhost in my hosts file.
In index.php, add a parameter to Mage::run() like so
//custom directories
$parentDir = dirname(dirname(__FILE__));
$customDirectories = array(
'media_dir' => $parentDir . '\common\media',
'var_dir' => $parentDir . '\common\var'
);
Mage::run($mageRunCode, $mageRunType, $customDirectories);
A full list of directory keys can be found on Alan Storm’s site at http://alanstorm.com/magento_base_directories.
To be able to pull images from the url as before, create a sub domain or another domain pointing to your new var and media directory location. On my local machine, I named mine www.common.localhost. In the core_config_data table of the database, update keys “web/secure/base_media_url” and “web/unsecure/base_media_url” with the url pointing to your new location, such as www.common.localhost/media.
That’s it! This solution works for magento 1.6.2.
Continue Reading
Posted by nick on March 10, 2012 at 3:57 pm
I was hoping to put a paypal subscription button on my website in about ten minutes today, but it ended up taking a couple hours because I could not figure out how to get paypal to pass back variables I needed, such as the customer id, order id, etc. I could configure custom variables on paypal’s website by “Add advanced variables” when setting up the buttons, such as the notify_url, but those did not work. The notify_url param did not pass back any of the custom information I provided to paypal, even though I used a hidden input named “custom” and along with a few others they suggested.
The solution was to use a hidden field when creating the button that would tell paypal where to send the customer after payment. I included the variables I needed in that url string and obfuscated them for security. Here is an example of one of my buttons -
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="AYXBEGS2YCZ6XPT4">
<input type="hidden" name="return" value="http://www.findlocalchurches.com/sign_up/successpage/1/<?php echo 'some number'?>/2/1" />
<input class="paypalButton" type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Continue Reading
Posted by nick on March 8, 2012 at 11:37 am
I’m new to Magento and this error took me a full day to solve. It would have helped if somebody had the solution on the internet, so I’m going to put it out there to help somebody else. On the catalog search, if you limit the products by price this error would show up Unknown column ‘price_table_price.attribute_id’ in ‘where clause’ . I’m going through upgrading a magento install from 1.3.4.2 to 1.6.2 and the method apply() from /app/code/Mage/Catalog/Model/Layer/Filter/Price.php had been overridden with a local method. At some point magento changed this method and the under workings, so the custom overridden method was out of date. Alter your custom method to better mimic the new version provided by magento to solve the issue.
Continue Reading
Posted by nick on March 6, 2012 at 12:22 pm
If you receive this error with Magento Exception with message ‘Warning: include(Mage\xxxx\Helper\Data.php) then it means you’re calling a helper somewhere and the helper’s XML config is missing. For this example, let’s say we have a helper called “custom”. First, ensure you’ve created a class at /app/code/local/Yourcompany/Custom/Helper/Data.php . Inside Data.php, there should be the following class:
<?php
class Yourcompany_Custom_Helper_Data extends Mage_Core_Helper_Abstract{}
Then in the file /app/etc/config.xml OR /app/code/local/Yourcompany/Custom/etc/config.xml, add the below xml:
<global>
<helpers>
<lpcustom>
<class>Yourcompany_Custom_Helper</class>
</lpcustom>
</helpers>
</global>
Continue Reading