I'm trying to change the order of the steps in the magento onepage checkout. What I need to do is to move the Review step before the Payment selection.
I've looked on the internet for a solution but everything I found was to change the order in app/code/core/Mage/Checkout/Block/Onepage/Abstract.php
I've tried it, but nothing changed.
What I did was creating a file inside app/code/local/Mage/Checkout/Block/Onepage/Abstract.phpand inside this file I've changed the line 208 in:
protected function _getStepCodes()
{
return array('login', 'billing', 'shipping', 'shipping_method', 'review', 'payment');
}
what am I missing here?
(I'm using Magento 1.9.1.1)
Don't change the php code.Keep it as it is.I think let the php do his work. But show the thing you want. Go to app->design->frontend->[package-name]->default->template->checkout->onepage->progress.phtml and open and change the order accordingly. Have fun.
Related
I need the Woocommerce cart to be cleaned in case I send more than four items to it via url.
I came up with this code, but it only cleans the cart if there are already five items in it.
//in functions.php
add_filter( 'woocommerce_add_to_cart_validation', 'remove_cart_item_before_add_to_cart', 20, 3 );
function remove_cart_item_before_add_to_cart( $passed, $product_id, $quantity ) {
if( WC()->cart->get_cart_contents_count() >= 5 )
WC()->cart->empty_cart();
return $passed;
}
Another problem is that, even the code above that is not useful to me, does not work if I add multiple courses via url, as in:
https://exemple.net/cart?fill_cart=100,101,102,103,104,105,106
That is, the code in functions.php only works from the website, and not by url.
All I need is clear the cart when sending more than 4 items by url.
I prefer a solution in PHP, but a JS solution will do. Thanks for who can help me.
I found a solution using the free plugin Cart links for WooCommerce, and making a few change in its code.
I will describe below what I did:
1) To start install the plugin, this will allow you to add products using the fill_cart parameter in url (as described in my question)
2) edit the plugin file soft79-cart-links-for-woocommerce.php found at: yoursite/wp-content/plugins/soft79-cart-links-for-woocommerce/
3) go to line 141 or find the declaration of the method fill_cart
Inside the fill_cart method uncomment (or add) the code to clean the cart:
public function fill_cart( $fill_string ) {
$original_notices = wc_get_notices();
wc_clear_notices();
////Clear the cart
//WC()->cart->empty_cart(); <-- uncomment here!
Save the file. Now any new items that arrive via url must clean the cart first.
I created two group one is A and other is B . i want there multiple option as each have different prices as acording to customer group i have some code but it does not run properly it give a message as "Call to undefined method Cart\Customer::getCustomerGroupId() in C:\xampp\htdocs\postal\vqmod\vqcache\vq2-catalog_model_catalog_product.php on line 340".
the code is in vqmod xml file -enter code here
problem is there i can not know how to definde customer group id and this code is running in old version perfectly
the code is attach in link -- product-option by download-customer group
please check this and send me how to define and fix the bug.
the code run proper before login- wen i login then give error message.
I suggest to modify system\library\cart\customer.php to:
/create a function/
public function getCustomerGroupId() {
return $this->customer_group_id;
}
I am using a payment module with Prestashop 1.6, everything was working fine until an upgrade happened. The payment server return the validation data to an url like "http://..../validation.php".
This file tries to get the order using the cart id that is returned by the server and obviously cant find it, hence the cart is not emptied and the order not created.
I added logs into that file to see what is received. The CartID (data['reference']) is correct.
writeMessage("Trying to get the order id using the cart:".$data['reference']);
writeMessage(Order::getOrderByCartId((int)($data['reference'])));
if ($id_order = intval(Order::getOrderByCartId((int)($data['reference']))))
{
writeMessage("Got the order by cart id.");
writeMessage("Got the order by cart id:".$id_order);
$order = new Order($id_order);
...
I am wondering if the call to Order::getOrderByCartId is correct. Is it the right way to call this function?
Any idea?
I can answer my question. The issue was not on the call to getOrderByCartId as it is normal that at this moment the order is not created yet.
The issue is actually on the validation function of the module, second part of the if.
$module->validateOrder(intval($data['reference']), $orderStatus, $amount, $module->displayName, $orderMessage, NULL, $id_currency, true, $customer->secure_key);
I have the following issue with a Magento 1.8.1 installation. I have two store views, English, which is default, and Arabic.
In the English store view if I add a product to the shopping cart I am able to modify the quantity by inputing the new quantity in the qty box and clicking Update Shopping Cart, which changes the quantity and the totals.
However, when I switch over to the Arabic store view, I can't update the quantity of any products. I input the desired quantity and press update, but the page reloads with only 1 piece of the product, and the totals are unchanged. I've tested and I've noticed that the cart only updates only for quantities over 31.
I've tried / checked the following:
This line is present in cart.phtml - getBlockHtml('formkey'); ?>
This line is present in cart.phtml - getChildHtml('form_before') ?>
There are no Javascript errors
I am using the default cart functionality, no Ajax or anything else.
I've tried replacing the cart.phtml file with the original one in the base folder, the behavior is the same.
I've tried adding the Store ID to the URL, it didn't fix the issue.
CLeared cache manually.
There are no errors in the php logs.
I've set up Manage stocks in Catalog/Inventory and reindexed, it didn't fix the issue.
Any ideas will be greatly appreciated.
Thanks,
Alex
Try to remove this code by overriding it on "local"
if (isset($params['qty'])) {
$filter = new Zend_Filter_LocalizedToNormalized(
array('locale' => Mage::app()->getLocale()->getLocaleCode())
);
$params['qty'] = $filter->filter($params['qty']);
}
from app\code\core\Mage\Checkout\controllers\CartController.php (line 183)
Create to overrride app\code\local\Mage\Checkout\controllers\CartController.php
And remove this also by overriding it on "local"
if (isset($data['qty'])) {
$cartData[$index]['qty'] = $filter->filter(trim($data['qty']));
}
from app\code\core\Mage\Checkout\controllers\CartController.php (line 428)
Create to override app\code\local\Mage\Checkout\controllers\CartController.php
Also remove this by overriding it on "local"
if (isset($params['qty'])) {
$filter = new Zend_Filter_LocalizedToNormalized(
array('locale' => Mage::app()->getLocale()->getLocaleCode())
);
$params['qty'] = $filter->filter($params['qty']);
}
from app\code\core\Mage\Checkout\controllers\CartController.php (line 327)
Create to override app\code\local\Mage\Checkout\controllers\CartController.php
For a client of mine I refactored some code that didn't work anymore. The script imports (variable) products from a CSV. That all works fine, the products and the attributes get imported and show up all complete in the backend.
The weird thing is, the products don't show up on the front-end of the website. That is, untill we save it just once from the backend (really, just pressing the save button for that product without doing anything else).
During the refactoring we found this code;
$test = new WC_Product($id);
$test->variable_product_sync();
$test = null;
This doesn't work anymore with the new WooCommerce, everything is static now. How can we implement this function now? And we are not sure this solves is though.
Ah, found it. You can dro the variable_product_sync. Make sure you set the meta _visible to 'visible' trough update_post_meta.
include_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-content/plugins/woocommerce/woocommerce.php' );
$product_variable = new WC_Product_Variable($product_id);
$product_variable->sync($product_id);
wc_delete_product_transients($product_id);