Open cart by external URL using cart IDBypass Magento's form key usage to allow simple product to be added to...

Is it a Cyclops number? "Nobody" knows!

Specifying a starting column with colortbl package and xcolor

Does an unused member variable take up memory?

Doesn't allowing a user mode program to access kernel space memory and execute the IN and OUT instructions defeat the purpose of having CPU modes?

What is better: yes / no radio, or simple checkbox?

Can I negotiate a patent idea for a raise, under French law?

What is this diamond of every day?

Outlet with 3 sets of wires

What is the generally accepted pronunciation of “topoi”?

Should I take out a loan for a friend to invest on my behalf?

Does Christianity allow for believing on someone else's behalf?

What do you call someone who likes to pick fights?

Recommendation letter by significant other if you worked with them professionally?

How do electrons receive energy when a body is heated?

Would an aboleth's Phantasmal Force lair action be affected by Counterspell, Dispel Magic, and/or Slow?

Are small insurances worth it?

From an axiomatic set theoric approach why can we take uncountable unions?

The meaning of ‘otherwise’

What ability score modifier does a javelin's damage use?

For which categories of spectra is there an explicit description of the fibrant objects via lifting properties?

After `ssh` without `-X` to a machine, is it possible to change `$DISPLAY` to make it work like `ssh -X`?

Can the alpha, lambda values of a glmnet object output determine whether ridge or Lasso?

School performs periodic password audits. Is my password compromised?

Called into a meeting and told we are being made redundant (laid off) and "not to share outside". Can I tell my partner?



Open cart by external URL using cart ID


Bypass Magento's form key usage to allow simple product to be added to cartExclude a specific categoryCreate categories through installerFresh install, no plug ins, fatal error on category management pageSharing Users and Cart in website with different storeviewsShopping cart is empty after cancel the payment in magento-1.9.1.1could not locate setShippingMethod function in magento 1.9Product price not displaying when I add to cartCreate order programmatically with UPS shipping methodMagento 1 with Php 7.2, add to cart error if product have option













0















I have a script that adds items to a cart from an external source. The cart is created and products added and now I want to return a URL to the cart.



This URL should open the checkout cart and display the cart contents.



Here is the script so far but it opens to an empty cart



<?php

include '../app/Mage.php';
Mage::app();

$cartId = $_GET['id'];

$quote = Mage::getModel('sales/quote')->load($cartId);

$quote->setIsActive(true)->save();

$Url= Mage::getUrl('checkout/cart');

echo $Url;

?>









share|improve this question














bumped to the homepage by Community 9 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • Is it just one product always? If so why don´t you just use this www.yourUrl/checkout/cart/add/product/PRODUCTID ?

    – Klettseb
    Jul 20 '16 at 15:44













  • No there are multiple products added to the cart in another php script. So once the cart is created and products added I need to open a new window from a url to view the checkout page

    – alQemist
    Jul 20 '16 at 16:09













  • I need a way to open a previously populated cart using cart id / url

    – alQemist
    Jul 20 '16 at 16:14
















0















I have a script that adds items to a cart from an external source. The cart is created and products added and now I want to return a URL to the cart.



This URL should open the checkout cart and display the cart contents.



Here is the script so far but it opens to an empty cart



<?php

include '../app/Mage.php';
Mage::app();

$cartId = $_GET['id'];

$quote = Mage::getModel('sales/quote')->load($cartId);

$quote->setIsActive(true)->save();

$Url= Mage::getUrl('checkout/cart');

echo $Url;

?>









share|improve this question














bumped to the homepage by Community 9 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • Is it just one product always? If so why don´t you just use this www.yourUrl/checkout/cart/add/product/PRODUCTID ?

    – Klettseb
    Jul 20 '16 at 15:44













  • No there are multiple products added to the cart in another php script. So once the cart is created and products added I need to open a new window from a url to view the checkout page

    – alQemist
    Jul 20 '16 at 16:09













  • I need a way to open a previously populated cart using cart id / url

    – alQemist
    Jul 20 '16 at 16:14














0












0








0








I have a script that adds items to a cart from an external source. The cart is created and products added and now I want to return a URL to the cart.



This URL should open the checkout cart and display the cart contents.



Here is the script so far but it opens to an empty cart



<?php

include '../app/Mage.php';
Mage::app();

$cartId = $_GET['id'];

$quote = Mage::getModel('sales/quote')->load($cartId);

$quote->setIsActive(true)->save();

$Url= Mage::getUrl('checkout/cart');

echo $Url;

?>









share|improve this question














I have a script that adds items to a cart from an external source. The cart is created and products added and now I want to return a URL to the cart.



This URL should open the checkout cart and display the cart contents.



Here is the script so far but it opens to an empty cart



<?php

include '../app/Mage.php';
Mage::app();

$cartId = $_GET['id'];

$quote = Mage::getModel('sales/quote')->load($cartId);

$quote->setIsActive(true)->save();

$Url= Mage::getUrl('checkout/cart');

echo $Url;

?>






magento-1.9 cart






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jul 20 '16 at 15:32









alQemistalQemist

11




11





bumped to the homepage by Community 9 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 9 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Is it just one product always? If so why don´t you just use this www.yourUrl/checkout/cart/add/product/PRODUCTID ?

    – Klettseb
    Jul 20 '16 at 15:44













  • No there are multiple products added to the cart in another php script. So once the cart is created and products added I need to open a new window from a url to view the checkout page

    – alQemist
    Jul 20 '16 at 16:09













  • I need a way to open a previously populated cart using cart id / url

    – alQemist
    Jul 20 '16 at 16:14



















  • Is it just one product always? If so why don´t you just use this www.yourUrl/checkout/cart/add/product/PRODUCTID ?

    – Klettseb
    Jul 20 '16 at 15:44













  • No there are multiple products added to the cart in another php script. So once the cart is created and products added I need to open a new window from a url to view the checkout page

    – alQemist
    Jul 20 '16 at 16:09













  • I need a way to open a previously populated cart using cart id / url

    – alQemist
    Jul 20 '16 at 16:14

















Is it just one product always? If so why don´t you just use this www.yourUrl/checkout/cart/add/product/PRODUCTID ?

– Klettseb
Jul 20 '16 at 15:44







Is it just one product always? If so why don´t you just use this www.yourUrl/checkout/cart/add/product/PRODUCTID ?

– Klettseb
Jul 20 '16 at 15:44















No there are multiple products added to the cart in another php script. So once the cart is created and products added I need to open a new window from a url to view the checkout page

– alQemist
Jul 20 '16 at 16:09







No there are multiple products added to the cart in another php script. So once the cart is created and products added I need to open a new window from a url to view the checkout page

– alQemist
Jul 20 '16 at 16:09















I need a way to open a previously populated cart using cart id / url

– alQemist
Jul 20 '16 at 16:14





I need a way to open a previously populated cart using cart id / url

– alQemist
Jul 20 '16 at 16:14










1 Answer
1






active

oldest

votes


















0














Replace current quote:



$quote = Mage::getModel('sales/quote')->load($quoteId);
Mage::getSingleton('checkout/session')->replaceQuote($quote);


But it will be better to merge custom quote items to current quote



$currentQuote = Mage::getSingleton('checkout/session')->getQuote();
var_dump($currentQuote->getData());

$items = $currentQuote->getAllItems();

var_dump('before: ' . count($items) . ' items');
foreach ($items as $item) {
var_dump($item->getId());
}

$quote = Mage::getModel('sales/quote')->load($quoteId);

// add custom validation
$isAllowedToBeAdded = $quote->getId();

if ($isAllowedToBeAdded) {

// Merge your quote to current quote
$currentQuote->merge($quote)
->collectTotals()
->save();

Mage::getSingleton('checkout/session')->replaceQuote($currentQuote);
}

$items = $currentQuote->getAllItems();
var_dump('after: ' . count($items) . ' items');
foreach ($items as $item) {
var_dump($item->getId());
}
var_dump($currentQuote->getData());





share|improve this answer
























  • This is fine - the products are in the cart - now how to return a URL from your example that will open the checkout page ?? www.mySite.com/checkout.php/checkout/cart --- returns 404 www.mySite.com/index.php/checkout/cart - opens empty cart page

    – alQemist
    Jul 21 '16 at 17:28













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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f126653%2fopen-cart-by-external-url-using-cart-id%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









0














Replace current quote:



$quote = Mage::getModel('sales/quote')->load($quoteId);
Mage::getSingleton('checkout/session')->replaceQuote($quote);


But it will be better to merge custom quote items to current quote



$currentQuote = Mage::getSingleton('checkout/session')->getQuote();
var_dump($currentQuote->getData());

$items = $currentQuote->getAllItems();

var_dump('before: ' . count($items) . ' items');
foreach ($items as $item) {
var_dump($item->getId());
}

$quote = Mage::getModel('sales/quote')->load($quoteId);

// add custom validation
$isAllowedToBeAdded = $quote->getId();

if ($isAllowedToBeAdded) {

// Merge your quote to current quote
$currentQuote->merge($quote)
->collectTotals()
->save();

Mage::getSingleton('checkout/session')->replaceQuote($currentQuote);
}

$items = $currentQuote->getAllItems();
var_dump('after: ' . count($items) . ' items');
foreach ($items as $item) {
var_dump($item->getId());
}
var_dump($currentQuote->getData());





share|improve this answer
























  • This is fine - the products are in the cart - now how to return a URL from your example that will open the checkout page ?? www.mySite.com/checkout.php/checkout/cart --- returns 404 www.mySite.com/index.php/checkout/cart - opens empty cart page

    – alQemist
    Jul 21 '16 at 17:28


















0














Replace current quote:



$quote = Mage::getModel('sales/quote')->load($quoteId);
Mage::getSingleton('checkout/session')->replaceQuote($quote);


But it will be better to merge custom quote items to current quote



$currentQuote = Mage::getSingleton('checkout/session')->getQuote();
var_dump($currentQuote->getData());

$items = $currentQuote->getAllItems();

var_dump('before: ' . count($items) . ' items');
foreach ($items as $item) {
var_dump($item->getId());
}

$quote = Mage::getModel('sales/quote')->load($quoteId);

// add custom validation
$isAllowedToBeAdded = $quote->getId();

if ($isAllowedToBeAdded) {

// Merge your quote to current quote
$currentQuote->merge($quote)
->collectTotals()
->save();

Mage::getSingleton('checkout/session')->replaceQuote($currentQuote);
}

$items = $currentQuote->getAllItems();
var_dump('after: ' . count($items) . ' items');
foreach ($items as $item) {
var_dump($item->getId());
}
var_dump($currentQuote->getData());





share|improve this answer
























  • This is fine - the products are in the cart - now how to return a URL from your example that will open the checkout page ?? www.mySite.com/checkout.php/checkout/cart --- returns 404 www.mySite.com/index.php/checkout/cart - opens empty cart page

    – alQemist
    Jul 21 '16 at 17:28
















0












0








0







Replace current quote:



$quote = Mage::getModel('sales/quote')->load($quoteId);
Mage::getSingleton('checkout/session')->replaceQuote($quote);


But it will be better to merge custom quote items to current quote



$currentQuote = Mage::getSingleton('checkout/session')->getQuote();
var_dump($currentQuote->getData());

$items = $currentQuote->getAllItems();

var_dump('before: ' . count($items) . ' items');
foreach ($items as $item) {
var_dump($item->getId());
}

$quote = Mage::getModel('sales/quote')->load($quoteId);

// add custom validation
$isAllowedToBeAdded = $quote->getId();

if ($isAllowedToBeAdded) {

// Merge your quote to current quote
$currentQuote->merge($quote)
->collectTotals()
->save();

Mage::getSingleton('checkout/session')->replaceQuote($currentQuote);
}

$items = $currentQuote->getAllItems();
var_dump('after: ' . count($items) . ' items');
foreach ($items as $item) {
var_dump($item->getId());
}
var_dump($currentQuote->getData());





share|improve this answer













Replace current quote:



$quote = Mage::getModel('sales/quote')->load($quoteId);
Mage::getSingleton('checkout/session')->replaceQuote($quote);


But it will be better to merge custom quote items to current quote



$currentQuote = Mage::getSingleton('checkout/session')->getQuote();
var_dump($currentQuote->getData());

$items = $currentQuote->getAllItems();

var_dump('before: ' . count($items) . ' items');
foreach ($items as $item) {
var_dump($item->getId());
}

$quote = Mage::getModel('sales/quote')->load($quoteId);

// add custom validation
$isAllowedToBeAdded = $quote->getId();

if ($isAllowedToBeAdded) {

// Merge your quote to current quote
$currentQuote->merge($quote)
->collectTotals()
->save();

Mage::getSingleton('checkout/session')->replaceQuote($currentQuote);
}

$items = $currentQuote->getAllItems();
var_dump('after: ' . count($items) . ' items');
foreach ($items as $item) {
var_dump($item->getId());
}
var_dump($currentQuote->getData());






share|improve this answer












share|improve this answer



share|improve this answer










answered Jul 20 '16 at 20:59









Neklo.comNeklo.com

2,2791518




2,2791518













  • This is fine - the products are in the cart - now how to return a URL from your example that will open the checkout page ?? www.mySite.com/checkout.php/checkout/cart --- returns 404 www.mySite.com/index.php/checkout/cart - opens empty cart page

    – alQemist
    Jul 21 '16 at 17:28





















  • This is fine - the products are in the cart - now how to return a URL from your example that will open the checkout page ?? www.mySite.com/checkout.php/checkout/cart --- returns 404 www.mySite.com/index.php/checkout/cart - opens empty cart page

    – alQemist
    Jul 21 '16 at 17:28



















This is fine - the products are in the cart - now how to return a URL from your example that will open the checkout page ?? www.mySite.com/checkout.php/checkout/cart --- returns 404 www.mySite.com/index.php/checkout/cart - opens empty cart page

– alQemist
Jul 21 '16 at 17:28







This is fine - the products are in the cart - now how to return a URL from your example that will open the checkout page ?? www.mySite.com/checkout.php/checkout/cart --- returns 404 www.mySite.com/index.php/checkout/cart - opens empty cart page

– alQemist
Jul 21 '16 at 17:28




















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f126653%2fopen-cart-by-external-url-using-cart-id%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

“%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

變成蝙蝠會怎樣? 參考資料 外部連結 导航菜单Thomas Nagel, "What is it like to be a...