コード例 #1
0
    $deleteEvent = false;
}
$user = Mage::getSingleton('customer/session')->getCustomer();
if (!empty($user)) {
    define("SC_CUSTOMER_FIRSTNAME", $user->getFirstname());
    define("SC_CUSTOMER_LASTNAME", $user->getLastname());
    define("SC_CUSTOMER_EMAIL", $user->getEmail());
}
//pobranie wartości z koszyka
$total_cart_price = Mage::getSingleton('checkout/cart')->getQuote()->getGrandTotal();
//SPRAWDZENIE ISTNIENIA KODU W SHOPCONNECTOR
$coupon = new CheckCouponClient($discountName);
//wysyłanie wartości koszyka aby sprawdzić czy jest wyższa niż minimalna wartość zakupów
$coupon->setCartValue($total_cart_price);
//sprawdzenie kuponu w shopconnector
$couponCorrect = $coupon->check(HASH);
if ($couponCorrect !== true) {
    Mage::getSingleton('core/session')->addNotice($couponCorrect);
}
$myfile = fopen("cokolwiek.txt", "w") or die("Unable to open file!");
$txt = "i tu tez dziala\n";
fwrite($myfile, $txt);
fclose($myfile);
//JEŚLI JEST KOD W SHOPCONNECTOR - TO SPRAWDZ CZY JEST JUZ W SYSTEMIE SKLEPU
if (!empty($discountName) && $couponCorrect === true) {
    //usuwam ze sklepu
    if ($deleteEvent) {
        $coupon = Mage::getModel('salesrule/coupon')->load($discountName, 'code');
        $ress = $coupon->getRuleId();
        //JEŚLI KOD ISTNIEJE W SKLEPIE TO GO USUWAMY
        if (!empty($ress)) {
コード例 #2
0
 //UNIKALNY HASH KAŻDEGO PARTNERA
 include_once "check_coupon_client.php";
 $cart = Context::getContext()->cart;
 $discountName = $_REQUEST['discount_name'];
 //POBRANIE KODU Z GET LUB POST
 $customer = new Customer($cart->id_customer);
 //DEFINICJA PODSTAWOWYCH DANYCH ZALOGOWANEGO UŻYTKOWNIKA - PRESTA CODE
 define("SC_CUSTOMER_FIRSTNAME", $customer->firstname);
 define("SC_CUSTOMER_LASTNAME", $customer->lastname);
 define("SC_CUSTOMER_EMAIL", $customer->email);
 //$cart = new Cart();
 $total_cart_price = $cart->getOrderTotal();
 $coupon = new CheckCouponClient($discountName);
 //SPRAWDZENIE ISTNIENIA KODU W SHOPCONNECTOR
 $coupon->setCartValue((string) $total_cart_price);
 $couponData = $coupon->check(HASH);
 $showPopup = $coupon->getShowPopup();
 $showBanner = $coupon->getShowBanner();
 $sendEmail = $coupon->getSendEmail();
 $scShopId = $coupon->getScShopId();
 $minimalCartValue = $coupon->getMinCart();
 //JEŚLI JEST KOD W SHOPCONNECTOR - TO SPRAWDZ CZY JEST JUZ W SYSTEMIE SKLEPU
 if (!empty($discountName)) {
     $discountValue = (string) $coupon->getDiscountType();
     $discount = new CartRuleCore(intval(CartRuleCore::getIdByCode($discountName)));
     //PRESTA CODE
     //JEŚLI KOD NIE ISTNIEJE W SKLEPIE TO DODAJEMY GO, DZIĘKI TEMU MOŻE GO WYKORZYSTAĆ KLIENT
     if (is_object($discount) and !$discount->id) {
         //PRESTA CODE
         if ($couponData === true) {
             try {