Flat Shipping rate for per 3 product in magento?
I am trying to create a shipping rule in magento. In this rule I need some functionality like $50 per 3 products will add as shipping rule. If someone added 4 items to 6 items in cart, then the shipping charges should $100 ($50 for first 3 pair of items and other $50 for remain items).
But i am stuck and didn't found any extension or solution for this.
shipping
add a comment |
I am trying to create a shipping rule in magento. In this rule I need some functionality like $50 per 3 products will add as shipping rule. If someone added 4 items to 6 items in cart, then the shipping charges should $100 ($50 for first 3 pair of items and other $50 for remain items).
But i am stuck and didn't found any extension or solution for this.
shipping
if 7 item then shipping cost 150???
– Gopal Patel
Feb 25 '17 at 12:01
yes...exactly what i want...
– Yudi
Feb 25 '17 at 12:21
magento version ?
– Gopal Patel
Feb 25 '17 at 13:02
add a comment |
I am trying to create a shipping rule in magento. In this rule I need some functionality like $50 per 3 products will add as shipping rule. If someone added 4 items to 6 items in cart, then the shipping charges should $100 ($50 for first 3 pair of items and other $50 for remain items).
But i am stuck and didn't found any extension or solution for this.
shipping
I am trying to create a shipping rule in magento. In this rule I need some functionality like $50 per 3 products will add as shipping rule. If someone added 4 items to 6 items in cart, then the shipping charges should $100 ($50 for first 3 pair of items and other $50 for remain items).
But i am stuck and didn't found any extension or solution for this.
shipping
shipping
edited 34 mins ago
Teja Bhagavan Kollepara
2,96341847
2,96341847
asked Feb 25 '17 at 11:08
YudiYudi
337121
337121
if 7 item then shipping cost 150???
– Gopal Patel
Feb 25 '17 at 12:01
yes...exactly what i want...
– Yudi
Feb 25 '17 at 12:21
magento version ?
– Gopal Patel
Feb 25 '17 at 13:02
add a comment |
if 7 item then shipping cost 150???
– Gopal Patel
Feb 25 '17 at 12:01
yes...exactly what i want...
– Yudi
Feb 25 '17 at 12:21
magento version ?
– Gopal Patel
Feb 25 '17 at 13:02
if 7 item then shipping cost 150???
– Gopal Patel
Feb 25 '17 at 12:01
if 7 item then shipping cost 150???
– Gopal Patel
Feb 25 '17 at 12:01
yes...exactly what i want...
– Yudi
Feb 25 '17 at 12:21
yes...exactly what i want...
– Yudi
Feb 25 '17 at 12:21
magento version ?
– Gopal Patel
Feb 25 '17 at 13:02
magento version ?
– Gopal Patel
Feb 25 '17 at 13:02
add a comment |
1 Answer
1
active
oldest
votes
Magento 1
Follow this tutorial to create custom shipping method
in config.xml
<default>
<carriers>
<customshipping>
<active>1</active>
<model>customshipping/carrier_customshipping</model>
<name>Custom Shipping</name>
<title>Custom Shipping </title>
<description>50 Shipping cost per 3 item</description>
<sort_order>1</sort_order>
</customshipping>
</carriers>
</default>
create shipping model class
<?php
class Stackexchange_Customshipping_Model_Carrier_Customshipping
extends Mage_Shipping_Model_Carrier_Abstract
implements Mage_Shipping_Model_Carrier_Interface
{
protected $_code = 'customshipping';
/**
* Collect rates for this shipping method based on information in $request
*
* @param Mage_Shipping_Model_Rate_Request $data
* @return Mage_Shipping_Model_Rate_Result
*/
public function collectRates(Mage_Shipping_Model_Rate_Request $request){
$result = Mage::getModel('shipping/rate_result');
if ($request->getAllItems()) {
$count=0;
foreach ($request->getAllItems() as $item) {
$count+=$item->getQty();
}
$count=ceil($count/3);
$method = Mage::getModel('shipping/rate_result_method');
$method->setCarrier($this->_code);
$method->setCarrierTitle($this->getConfigData('title'));
$method->setMethod($this->_code);
$method->setMethodTitle($this->getConfigData('name'));
$method->setPrice($count*50);
$method->setCost($count*50);
$result->append($method);
}
else
{
$error = Mage::getModel('shipping/rate_result_error');
$error->setCarrier($this->_code);
$error->setCarrierTitle($this->getConfigData('name'));
$error->setErrorMessage('Shipping Method is not available');
$result->append($error);
}
return $result;
}
/**
* Get allowed shipping methods
*
* @return array
*/
public function getAllowedMethods()
{
return array($this->_code=>$this->getConfigData('name'));
}
}
Created module for you.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f161749%2fflat-shipping-rate-for-per-3-product-in-magento%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Magento 1
Follow this tutorial to create custom shipping method
in config.xml
<default>
<carriers>
<customshipping>
<active>1</active>
<model>customshipping/carrier_customshipping</model>
<name>Custom Shipping</name>
<title>Custom Shipping </title>
<description>50 Shipping cost per 3 item</description>
<sort_order>1</sort_order>
</customshipping>
</carriers>
</default>
create shipping model class
<?php
class Stackexchange_Customshipping_Model_Carrier_Customshipping
extends Mage_Shipping_Model_Carrier_Abstract
implements Mage_Shipping_Model_Carrier_Interface
{
protected $_code = 'customshipping';
/**
* Collect rates for this shipping method based on information in $request
*
* @param Mage_Shipping_Model_Rate_Request $data
* @return Mage_Shipping_Model_Rate_Result
*/
public function collectRates(Mage_Shipping_Model_Rate_Request $request){
$result = Mage::getModel('shipping/rate_result');
if ($request->getAllItems()) {
$count=0;
foreach ($request->getAllItems() as $item) {
$count+=$item->getQty();
}
$count=ceil($count/3);
$method = Mage::getModel('shipping/rate_result_method');
$method->setCarrier($this->_code);
$method->setCarrierTitle($this->getConfigData('title'));
$method->setMethod($this->_code);
$method->setMethodTitle($this->getConfigData('name'));
$method->setPrice($count*50);
$method->setCost($count*50);
$result->append($method);
}
else
{
$error = Mage::getModel('shipping/rate_result_error');
$error->setCarrier($this->_code);
$error->setCarrierTitle($this->getConfigData('name'));
$error->setErrorMessage('Shipping Method is not available');
$result->append($error);
}
return $result;
}
/**
* Get allowed shipping methods
*
* @return array
*/
public function getAllowedMethods()
{
return array($this->_code=>$this->getConfigData('name'));
}
}
Created module for you.
add a comment |
Magento 1
Follow this tutorial to create custom shipping method
in config.xml
<default>
<carriers>
<customshipping>
<active>1</active>
<model>customshipping/carrier_customshipping</model>
<name>Custom Shipping</name>
<title>Custom Shipping </title>
<description>50 Shipping cost per 3 item</description>
<sort_order>1</sort_order>
</customshipping>
</carriers>
</default>
create shipping model class
<?php
class Stackexchange_Customshipping_Model_Carrier_Customshipping
extends Mage_Shipping_Model_Carrier_Abstract
implements Mage_Shipping_Model_Carrier_Interface
{
protected $_code = 'customshipping';
/**
* Collect rates for this shipping method based on information in $request
*
* @param Mage_Shipping_Model_Rate_Request $data
* @return Mage_Shipping_Model_Rate_Result
*/
public function collectRates(Mage_Shipping_Model_Rate_Request $request){
$result = Mage::getModel('shipping/rate_result');
if ($request->getAllItems()) {
$count=0;
foreach ($request->getAllItems() as $item) {
$count+=$item->getQty();
}
$count=ceil($count/3);
$method = Mage::getModel('shipping/rate_result_method');
$method->setCarrier($this->_code);
$method->setCarrierTitle($this->getConfigData('title'));
$method->setMethod($this->_code);
$method->setMethodTitle($this->getConfigData('name'));
$method->setPrice($count*50);
$method->setCost($count*50);
$result->append($method);
}
else
{
$error = Mage::getModel('shipping/rate_result_error');
$error->setCarrier($this->_code);
$error->setCarrierTitle($this->getConfigData('name'));
$error->setErrorMessage('Shipping Method is not available');
$result->append($error);
}
return $result;
}
/**
* Get allowed shipping methods
*
* @return array
*/
public function getAllowedMethods()
{
return array($this->_code=>$this->getConfigData('name'));
}
}
Created module for you.
add a comment |
Magento 1
Follow this tutorial to create custom shipping method
in config.xml
<default>
<carriers>
<customshipping>
<active>1</active>
<model>customshipping/carrier_customshipping</model>
<name>Custom Shipping</name>
<title>Custom Shipping </title>
<description>50 Shipping cost per 3 item</description>
<sort_order>1</sort_order>
</customshipping>
</carriers>
</default>
create shipping model class
<?php
class Stackexchange_Customshipping_Model_Carrier_Customshipping
extends Mage_Shipping_Model_Carrier_Abstract
implements Mage_Shipping_Model_Carrier_Interface
{
protected $_code = 'customshipping';
/**
* Collect rates for this shipping method based on information in $request
*
* @param Mage_Shipping_Model_Rate_Request $data
* @return Mage_Shipping_Model_Rate_Result
*/
public function collectRates(Mage_Shipping_Model_Rate_Request $request){
$result = Mage::getModel('shipping/rate_result');
if ($request->getAllItems()) {
$count=0;
foreach ($request->getAllItems() as $item) {
$count+=$item->getQty();
}
$count=ceil($count/3);
$method = Mage::getModel('shipping/rate_result_method');
$method->setCarrier($this->_code);
$method->setCarrierTitle($this->getConfigData('title'));
$method->setMethod($this->_code);
$method->setMethodTitle($this->getConfigData('name'));
$method->setPrice($count*50);
$method->setCost($count*50);
$result->append($method);
}
else
{
$error = Mage::getModel('shipping/rate_result_error');
$error->setCarrier($this->_code);
$error->setCarrierTitle($this->getConfigData('name'));
$error->setErrorMessage('Shipping Method is not available');
$result->append($error);
}
return $result;
}
/**
* Get allowed shipping methods
*
* @return array
*/
public function getAllowedMethods()
{
return array($this->_code=>$this->getConfigData('name'));
}
}
Created module for you.
Magento 1
Follow this tutorial to create custom shipping method
in config.xml
<default>
<carriers>
<customshipping>
<active>1</active>
<model>customshipping/carrier_customshipping</model>
<name>Custom Shipping</name>
<title>Custom Shipping </title>
<description>50 Shipping cost per 3 item</description>
<sort_order>1</sort_order>
</customshipping>
</carriers>
</default>
create shipping model class
<?php
class Stackexchange_Customshipping_Model_Carrier_Customshipping
extends Mage_Shipping_Model_Carrier_Abstract
implements Mage_Shipping_Model_Carrier_Interface
{
protected $_code = 'customshipping';
/**
* Collect rates for this shipping method based on information in $request
*
* @param Mage_Shipping_Model_Rate_Request $data
* @return Mage_Shipping_Model_Rate_Result
*/
public function collectRates(Mage_Shipping_Model_Rate_Request $request){
$result = Mage::getModel('shipping/rate_result');
if ($request->getAllItems()) {
$count=0;
foreach ($request->getAllItems() as $item) {
$count+=$item->getQty();
}
$count=ceil($count/3);
$method = Mage::getModel('shipping/rate_result_method');
$method->setCarrier($this->_code);
$method->setCarrierTitle($this->getConfigData('title'));
$method->setMethod($this->_code);
$method->setMethodTitle($this->getConfigData('name'));
$method->setPrice($count*50);
$method->setCost($count*50);
$result->append($method);
}
else
{
$error = Mage::getModel('shipping/rate_result_error');
$error->setCarrier($this->_code);
$error->setCarrierTitle($this->getConfigData('name'));
$error->setErrorMessage('Shipping Method is not available');
$result->append($error);
}
return $result;
}
/**
* Get allowed shipping methods
*
* @return array
*/
public function getAllowedMethods()
{
return array($this->_code=>$this->getConfigData('name'));
}
}
Created module for you.
answered Feb 25 '17 at 13:08
Gopal PatelGopal Patel
2,9952930
2,9952930
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f161749%2fflat-shipping-rate-for-per-3-product-in-magento%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
if 7 item then shipping cost 150???
– Gopal Patel
Feb 25 '17 at 12:01
yes...exactly what i want...
– Yudi
Feb 25 '17 at 12:21
magento version ?
– Gopal Patel
Feb 25 '17 at 13:02