Thursday, December 30, 2010

Customizing Onepage Checkout - Remove shipping_method

Give our namespace name - “Digg“. So you have a folder in app/local/Digg for modules and module “Checkout”.

You must add next files to you module:

1.Block Digg/Checkout/Block/Onepage/Shipping/Method.php
2.Controller Digg/Checkout/controllers/OnepageController.php
3.Model Digg/Checkout/Model/Type/Onepage.php
4.Configuration Digg/Checkout/etc/config.xml

1. Block (Method.php)


To disable Shipping Method for checkout list, you must hide it. Our custom shipping method inherited from core Mage_Checkout_Block_Onepage_Shipping_Method class. Overload method isShow and return false:
class Digg_Checkout_Block_Onepage_Shipping_Method extends


2. Controller (OnepageController.php)


Important:Controllers have no autoloading so you must include it manualy. Overwrite the function saveShippingAction() and saveBillingAction() to skip shipping method to payment with the following code:

_expireAjax()) {
return;
}
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost('shipping', array());
$customerAddressId = $this->getRequest()->getPost('shipping_address_id', false);
$result = $this->getOnepage()->saveShipping($data, $customerAddressId);
if (!isset($result['error'])) {
$result['goto_section'] = 'payment';
$result['update_section'] = array(
'name' => 'payment-method',
'html' => $this->_getPaymentMethodsHtml()
);
}
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}
public function saveBillingAction()
{
if ($this->_expireAjax()) {
return;
}
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost('billing', array());
$customerAddressId = $this->getRequest()->getPost('billing_address_id', false);
$result = $this->getOnepage()->saveBilling($data, $customerAddressId);
if (!isset($result['error'])) {
/* check quote for virtual */
if ($this->getOnepage()->getQuote()->isVirtual()) {
$result['goto_section'] = 'payment';
$result['update_section'] = array(
'name' => 'payment-method',
'html' => $this->_getPaymentMethodsHtml()
);
}
elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {

$result['goto_section'] = 'payment';
$result['update_section'] = array(
'name' => 'payment-method',
'html' => $this->_getPaymentMethodsHtml()
);
}
else {
$result['goto_section'] = 'shipping';
}
}
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}
}

?>




3. Model (Onepage.php)


The simplest way to ask magento to ignore shipping info is to change validation rule. Te following code overwriting validateOrder() method. I just removed part of original code that validate non-virtual products


getQuote()->getIsMultiShipping()) {
Mage::throwException($helper->__('Invalid checkout type.'));
}

$addressValidation = $this->getQuote()->getBillingAddress()->validate();
if ($addressValidation !== true) {
Mage::throwException($helper->__('Please check billing address information.'));
}

if (!($this->getQuote()->getPayment()->getMethod())) {
Mage::throwException($helper->__('Please select valid payment method.'));
}
}
}

?>



4. Configuration (config.xml)


Last step is configurate our module. The main idea is to ask Magento first searching action methods in our Digg module and if it didn’t found use core.





0.0.2






Digg_Checkout_Model_Type_Onepage






Digg_Checkout_Block_Onepage_Shipping_Method









Digg_Checkout








Don’t forget to register your module in app/etc/modules/Digg_All.xml:





true
local




For more information go here :

http://www.magentocommerce.com/wiki/5_-_modules_and_development/checkout/customizing_onepage_checkout_-_remove_shipping_method?do=show

Customizing Onepage Checkout - Remove login - Magento

Q. How to remove login block from OnepageCheckout? Every customer checkout as guest.


1.) /app/design/frontend/default/detault/layout/checkout.xml 
 Comment out or remove the reference to “checkout.onepage.login” addLink under the checkout_onepage_index section.




2.) /app/design/frontend/default/default/template/checkout/onepage.phtml 

 Edit the code at the bottom (see line 2 line 19):

  1. <input type="hidden" name="checkout_method" id="login:guest" checked="checked" value="guest">
  2. type="text/javascript">
  3. //<![CDATA[
  4.     var accordion = new Accordion('checkoutSteps', '.head', true);
  5.     <;?php if($this->getActiveStep()): ?>
  6.     accordion.openSection('opc-billing');
  7.     <?php endif ?>
  8.     var checkout = new Checkout(accordion,{
  9.         progress: '<?php echo $this->getUrl('checkout/onepage/progress') ?>,
  10.         review: '<?php echo $this->getUrl('checkout/onepage/review') ?>;',
  11.         saveMethod: '<?php echo $this->getUrl('checkout/onepage/saveMethod') ?>',
  12.         failure: '<?php echo $this->getUrl('checkout/cart') ?>'}
  13.     );
  14.     // Go to the next method on start (it will look for the input we added above)
  15.     //IE fix
  16.     var cb = $("login:guest");
  17.     cb.checked = true;
  18.     checkout.setMethod();  // MAKE SURE TO ADD THIS LINE!!!
  19. //]]>
The checkout.setMethod() will move to the next checkout method (billing) if it sees that the input for a guest is checked (hence why we add the hidden input)Code Text





Wednesday, September 1, 2010

Information on the ZendX jQuery Proposals

When  I was wondering about the jqueryui  helper in zend frame work the I came across these demos. You can find a great help to start jquery support in zend framework. Just check this out ...


http://www.beberlei.de/jquery/demo/

http://www.beberlei.de/jquery/demo/formdemo.php

Tuesday, June 8, 2010

How to use Reliance Broadband+ Netconnect with Ubuntu Linux

Open the Terminal (Application->Accessories->Terminal)

Type SU (Super User, gives administrative privilege will need it little later). Key in the password .

then,

lsusb

Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 003: ID 12d1:1412 Huawei Technologies Co., Ltd.
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

This thing pops Out

Note down the no just before Huawei or quallcom depending on which card you use . To my experience all cards of the same vendor will have the same id. like for Huawei itll be 12d1:1412.

next,

modprobe usbserial vendor=0xAAAA product=0xBBBB ,

Where AAAA is 12d1 and BBBB is 1412 in my case.

Then you have to edit wvdial.conf file, type,

gedit /etc/wvdial.conf

This will open wvdial.conf.

(NOTE: wvdial might not be installed , to install it .
Insert original UBUNTU CD

Go to System->Administration->software sources. add cd as a source and close . itll update itself, Then on terminal type,
sudo apt-get install wvdial .

And key in Ur password , that shall do.

NOW coming back to wvdial .conf. Copy and paste this overriding the previous setting in .

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Stupid Mode = 1
Modem Type = USB Modem
ISDN = 0
Phone = #777
New PPPD = yes
Modem = /dev/ttyUSB0
Username = 9310590985 (This is the no written in the back side and changes in every card).
Password = 9310590985 (This is the no written in the back side and changes in every card and is same as user name).
CBaud = 460800

Save it and exist .

Next,

Just enter terminal and sudo Wvdial
And your password to getconnected.