For Yum based OS:
sudo yum install pcre-devel
sudo pecl install apc
Then create /etc/php.d/apc.ini
insert content as follows:
extension=apc.so
then restart httpd
If you are still having some problem installing this, try refer here:
http://www.agileapproach.com/blog-entry/howto-install-pecl-apc-cache-centos-without-xampp
Friday, March 30, 2012
Tuesday, March 27, 2012
Magento Order status does not convert to Processing
Tinkering around to make a payment gateway integration for iPay88 took me some really significant time.
I've been using some method from paypal module to redirect the form to ipay88,
and does a re-query to ipay88 server to determine the approve of transaction from ipay88.
On done, created an invoice and saved the transaction for the invoice.
Payment paid appears correctly, but some how order status still remain "pending".
I realized that i did not set the cctransid to the payment in my controller,
so one way to do it is to pass the TransId from controller to payment method model.
To do this, create a model class to accommodate values from request form passed in from ipay88,
then in payment method model capture function, retrieve the ipay88 returned model and setCcTransId(...).
When done, the order will now be shown as "processing", depending on the setting in the admin configuration for the payment status on payment.
Sample below:
//getting config saved in admin:
$aConfig = Mage::getStoreConfig("payment/Ipay88");
$merchantcode = $aConfig["merchantcode"];
$oResponse = Mage::getSingleton("Ipay88/Api_Response");
//convert data from postback of ipay88 into oResponse as object data
Varien_Object_Mapper::accumulateByMap($_REQUEST, $oResponse, array(
"MerchantCode", "PaymentId", "RefNo", "Amount", "Currency", "TransId", "AuthCode", "Status",
"ErrDesc", "Signature", "Remark")
);
//codes to requery ipay88 for actual transaction
//...
if ($iPayResult == "00") {
//success
//update order status and payment status
if ($oOrder->canInvoice()) {
$invoice = Mage::getModel('sales/service_order', $oOrder)->prepareInvoice();
if (! $invoice->getTotalQty()) {
Mage::throwException(Mage::helper('core')->__('Cannot create an invoice without products.'));
}
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
$invoice->setTransactionId($cctransid);
//below this will trigger capture in method model
$invoice->register();
$transactionSave = Mage::getModel('core/resource_transaction')
->addObject($invoice)
->addObject($invoice->getOrder());
$transactionSave->save();
}
}
Next, in the payment method model capture:
public function capture(Varien_Object $payment, $amount)
{
if (!$this->canCapture()) {
Mage::throwException($this->_getHelper()->__('Capture action is not available.'));
}
$oResponse = Mage::getSingleton("Ipay88/Api_Response");
$payment->setCcTransId($oResponse["TransId"]);
return $this;
}
Sample of iPay88 Model to hold request data
class MercStudio_Ipay88_Model_Api_Response extends Varien_Object {
}
Yes, its an empty class which extends Varien_Object :)
The Magic of Varien object is that it accept any data set to it (setVariablename(value) or setData("variablename", value)), and you may retrieve the data by calling getData("variablename")
Monday, March 26, 2012
jQuery .load complete did not fire
This happen when i was dealing with an upgrade from jQuery 1.5 to 1.7.2.
It took me some struggle to find out what happened, and finally, i found the issue.
It seems that the oncomplete function will not run if the document itself somehow contains javascript with syntax error in the script. It wasn't any problem for jQuery1.5, but for jQuery 1.7.2, it seems to halt execution after loading the content to the targeted dom.
It took me some struggle to find out what happened, and finally, i found the issue.
It seems that the oncomplete function will not run if the document itself somehow contains javascript with syntax error in the script. It wasn't any problem for jQuery1.5, but for jQuery 1.7.2, it seems to halt execution after loading the content to the targeted dom.
MODx Return Error 400 in manager
The recent changes on MODx seems to create a new kind of error 400 on all the javascript used in the manager screen.
The problem comes from issue with minified index.php where it over replaced manager/assets with assets path, therefore doubling the path to the actual javascript file.
The solution have been resolved in the nightly build of MODx 2.2.1.pl
http://tracker.modx.com/issues/7418
The problem comes from issue with minified index.php where it over replaced manager/assets with assets path, therefore doubling the path to the actual javascript file.
The solution have been resolved in the nightly build of MODx 2.2.1.pl
http://tracker.modx.com/issues/7418
Monday, March 19, 2012
Facebook integration hickup
After encountering some weird behaviour of facebook login session on client side,
i just realized that the flow of the code have to be correct.
window.fbAsyncInit = function(...);
the code above should come first, before including facebook js file below:
[script]http://connect.facebook.net/en_US/all.js[/script]
i just realized that the flow of the code have to be correct.
window.fbAsyncInit = function(...);
the code above should come first, before including facebook js file below:
[script]http://connect.facebook.net/en_US/all.js[/script]
Friday, March 16, 2012
Tuesday, March 13, 2012
Magento Export Sales Order Duplicate headers received from server
Its a bug which have been fixed in magento 1.7.
But for 1.6.2 users, you may change the core to fix this in:
app/code/core/Mage/Core/Controller/Varien/Action.php in function _prepareDownloadResponse:
But for 1.6.2 users, you may change the core to fix this in:
app/code/core/Mage/Core/Controller/Varien/Action.php in function _prepareDownloadResponse:
By adding , true as the 3rd parameter in these lines:
->setHeader('Content-Length', is_null($contentLength) ? strlen($content) : $contentLength, true)
->setHeader('Content-Disposition', 'attachment; filename="'.$fileName.'"', true)
->setHeader('Last-Modified', date('r'), true);
Subscribe to:
Posts (Atom)