0
외부 PHP 파일에서 Magento 카트에 액세스하려고하면 Mage가로드되어 제품 &에 액세스 할 수 있지만 어떤 이유로 카트 정보에 액세스 할 수 없습니다.magento - 외부 PHP 파일의 카트 액세스
숍이 '/'로 설정되어 www.domain.com/file.php 젠토 쿠키 설정에 있습니다 www.domain.com/shop/ PHP 파일에 있습니다
나는 보았다하고 정보를 얻는 방법의 많은 예를 시도하고 그들 중 누구도 일하지, 나는이 순간에있는 코드는 다음과 같습니다
는<?php
require_once '/home/admin/public_html/shop/appMage.php';
Mage::app();
Mage::getSingleton('checkout/cart', array('name' => 'frontend'));
$cartItemsCount = Mage::getSingleton('checkout/cart')->getItemsCount();
$cartTotal = Mage::helper('checkout')->formatPrice(Mage::getSingleton('checkout/cart')->getQuote()->getGrandTotal());
echo 'You have '. $cartItemsCount . ' item(s) in your cart. <a class="cartgo" href="'.Mage::helper('checkout/cart')->getCartUrl().'">Checkout</a>';
if($cartTotal > 0){ echo '<span>[£'.$cartTotal.']</span>'; }
echo '</a>';
?>
는하지만 어떤 이유로이 외부 파일에서 젠토 사이트 내에서 완벽하게 작동합니다. 카트에 제품이 있어도 0을 반환합니다.
모든 포인터?
를 참조하십시오! – user2355278
v1.7.0에서 코드를 테스트하기 만하면 작동합니다. 어떤 오류가 발생하고 있습니까? 마지막에'echo $ cartItemsCount'를 추가 했습니까? –
예 - 0은 내가 어떤 이유로 얻는 것입니다. (다른 모든 통합은 제품/카테고리와 잘 작동합니다. 장바구니/세션 비트입니다. 쿠키와 함께 할 일이 있습니다. – user2355278