Обьединил первый шаг корзины с таблицей товаров. Не работает кнопка пересчитать

#
Обьединил первый шаг корзины с таблицей товаров. Не работает кнопка пересчитать
Здравствуйте, обьединил первый шаг корзины с таблицей товаров. Не работает кнопка пересчитать, так все нормально функционирует, но при пересчете товаров выдает пустую страницу http://new.minoxidil-store.ru/shop/cart/
#
Re: Обьединил первый шаг корзины с таблицей товаров. Не работает кнопка пересчитать
PakoGonsalezZ,
Все элементарно. Пересчет у вас перекидывает POST запросом на первую страницу где уже ничего нет:
PakoGonsalezZ писал(а):
обьединил первый шаг корзины с таблицей товаров

Обратите внимание на:
<div class="actions">
          <button class="btn btn-secondary" type="submit" name="recount" value="recount">Пересчитать</button>
          <input name="step" value="1" type="hidden">
        </div>

E-mail: info@syrbek.ru / телега: @syrbek /skype: activexm / syrbek.ru / Поддержка сайтов / г. Москва [HTML, CSS (Bootstrap), JS(JQuery, ExtJS), PHP, MySQL, MSSql, Posgres, Git, SVN, Redmine]
#
Re: Обьединил первый шаг корзины с таблицей товаров. Не работает кнопка пересчитать
Так именно на первом шаге у меня и таблица  и ввод контактных данных, я перенес все в блок  case 1:

Вот код блока switch

// Проверяем наличие товара в корзины
$Shop_Cart_Controller = Shop_Cart_Controller::instance();
$aShop_Cart = $Shop_Cart_Controller->getAll($oShop);
if (!isset($_POST['step'])){
   $_POST['step'] = 1;
}
if (!count($aShop_Cart)){
   echo '<h1 class="item_title">Моя корзина</h1><p>В корзине нет ни одного товара</p>';
}
switch (Core_Array::getPost('recount') || !count($aShop_Cart) ? 0 : Core_Array::getPost('step')) {
    // Адрес доставки
    case 1:
   
      $Shop_Cart_Controller_Show
                ->couponText(
                        Core_Str::stripTags(Core_Array::get(Core_Array::get($_SESSION, 'hostcmsOrder', array()), 'coupon_text'))
                )
                ->xsl(
                        Core_Entity::factory('Xsl')->getByName($xslName)
                )
                ->show();
        // Сбрасываем информацию о последнем заказе
        $_SESSION['last_order_id'] = 0;

        $Shop_Address_Controller_Show = new Shop_Address_Controller_Show($oShop);
        
        $Shop_Address_Controller_Show->addEntity(
                Core::factory('Core_Xml_Entity')
               ->name('post_surname')->value(Core_Array::getPost('surname'))
        );
        $Shop_Address_Controller_Show->addEntity(
                Core::factory('Core_Xml_Entity')
               ->name('post_phone')->value(Core_Array::getPost('phone'))
        );
        $Shop_Address_Controller_Show->addEntity(
                Core::factory('Core_Xml_Entity')
               ->name('post_email')->value(Core_Array::getPost('email'))
        );
        
        $Shop_Address_Controller_Show->xsl(
                        Core_Entity::factory('Xsl')->getByName(
                                Core_Array::get(Core_Page::instance()->libParams, 'deliveryAddressXsl')
                        )
                )
                ->show();
      
        break;
    // Способ доставки
    case 2:
        $_SESSION['hostcmsOrder']['shop_country_id'] = intval(Core_Array::getPost('shop_country_id', 0));
        $_SESSION['hostcmsOrder']['shop_country_location_id'] = intval(Core_Array::getPost('shop_country_location_id', 0));
        $_SESSION['hostcmsOrder']['shop_country_location_city_id'] = intval(Core_Array::getPost('shop_country_location_city_id', 0));
        $_SESSION['hostcmsOrder']['shop_country_location_city_area_id'] = intval(Core_Array::getPost('shop_country_location_city_area_id', 0));
        $_SESSION['hostcmsOrder']['postcode'] = Core_Str::stripTags(strval(Core_Array::getPost('postcode')));
        $_SESSION['hostcmsOrder']['address'] = Core_Str::stripTags(strval(Core_Array::getPost('address')));
        $_SESSION['hostcmsOrder']['surname'] = Core_Str::stripTags(strval(Core_Array::getPost('surname')));
        $_SESSION['hostcmsOrder']['name'] = Core_Str::stripTags(strval(Core_Array::getPost('name')));
        $_SESSION['hostcmsOrder']['patronymic'] = Core_Str::stripTags(strval(Core_Array::getPost('patronymic')));
        $_SESSION['hostcmsOrder']['company'] = Core_Str::stripTags(strval(Core_Array::getPost('company')));
        $_SESSION['hostcmsOrder']['phone'] = Core_Str::stripTags(strval(Core_Array::getPost('phone')));
        $_SESSION['hostcmsOrder']['fax'] = Core_Str::stripTags(strval(Core_Array::getPost('fax')));
        $_SESSION['hostcmsOrder']['email'] = Core_Str::stripTags(strval(Core_Array::getPost('email')));
        $_SESSION['hostcmsOrder']['description'] = Core_Str::stripTags(strval(Core_Array::getPost('description')));
        $_SESSION['hostcmsOrder']['tin'] = Core_Str::stripTags(strval(Core_Array::getPost('tin')));
        $_SESSION['hostcmsOrder']['kpp'] = Core_Str::stripTags(strval(Core_Array::getPost('kpp')));

        // Additional order properties
        $_SESSION['hostcmsOrder']['properties'] = array();

        $oShop_Order_Property_List = Core_Entity::factory('Shop_Order_Property_List', $oShop->id);

        $aProperties = $oShop_Order_Property_List->Properties->findAll();
        foreach ($aProperties as $oProperty) {
            // Св-во может иметь несколько значений
            $aPropertiesValue = Core_Array::getPost('property_' . $oProperty->id);

            if (!is_null($aPropertiesValue)) {
                !is_array($aPropertiesValue) && $aPropertiesValue = array($aPropertiesValue);
                foreach ($aPropertiesValue as $sPropertyValue) {
                    $_SESSION['hostcmsOrder']['properties'][] = array($oProperty->id, $sPropertyValue);
                }
            }
        }

        $Shop_Delivery_Controller_Show = new Shop_Delivery_Controller_Show($oShop);

        $Shop_Delivery_Controller_Show
                ->shop_country_id($_SESSION['hostcmsOrder']['shop_country_id'])
                ->shop_country_location_id($_SESSION['hostcmsOrder']['shop_country_location_id'])
                ->shop_country_location_city_id($_SESSION['hostcmsOrder']['shop_country_location_city_id'])
                ->shop_country_location_city_area_id($_SESSION['hostcmsOrder']['shop_country_location_city_area_id'])
                ->couponText(
                        Core_Str::stripTags(
                                Core_Array::get(Core_Array::get($_SESSION, 'hostcmsOrder', array()), 'coupon_text')
                        )
                )
                ->postcode($_SESSION['hostcmsOrder']['postcode'])
                ->setUp()
                ->xsl(
                        Core_Entity::factory('Xsl')->getByName(
                                Core_Array::get(Core_Page::instance()->libParams, 'deliveryXsl')
                        )
                )
                ->show();
        break;
    // Форма оплаты
    case 3:
        $Shop_Payment_System_Controller_Show = new Shop_Payment_System_Controller_Show($oShop);

        $shop_delivery_condition_id = strval(Core_Array::getPost('shop_delivery_condition_id', 0));

        if (is_numeric($shop_delivery_condition_id)) {
            $_SESSION['hostcmsOrder']['shop_delivery_condition_id'] = intval($shop_delivery_condition_id);

            $oShop_Delivery_Condition = Core_Entity::factory('Shop_Delivery_Condition', $_SESSION['hostcmsOrder']['shop_delivery_condition_id']);
            $_SESSION['hostcmsOrder']['shop_delivery_id'] = $oShop_Delivery_Condition->shop_delivery_id;
        } else {
            $_SESSION['hostcmsOrder']['shop_delivery_condition_id'] = 0;

            // в shop_delivery_condition_id тогда "10-123#", ID элемента массива в сессии, в котором
            // хранится стоимость доставки, налог, название специфичного условия доставки
            list($shopDeliveryInSession) = explode('#', $shop_delivery_condition_id);

            if (isset($_SESSION['hostcmsOrder']['deliveries'][$shopDeliveryInSession])) {
                $aTmp = $_SESSION['hostcmsOrder']['deliveries'][$shopDeliveryInSession];

                $_SESSION['hostcmsOrder']['shop_delivery_id'] = $aTmp['shop_delivery_id'];
                $_SESSION['hostcmsOrder']['shop_delivery_price'] = $aTmp['price'];
                $_SESSION['hostcmsOrder']['shop_delivery_rate'] = $aTmp['rate'];
                $_SESSION['hostcmsOrder']['shop_delivery_name'] = $aTmp['name'];
            }
        }

        $Shop_Payment_System_Controller_Show
                ->shop_delivery_id(Core_Array::get($_SESSION['hostcmsOrder'], 'shop_delivery_id'))
                ->xsl(
                        Core_Entity::factory('Xsl')->getByName(
                                Core_Array::get(Core_Page::instance()->libParams, 'paymentSystemXsl')
                        )
                )
                ->show();
        break;
    // Окончание оформления заказа
    case 4:
        $shop_payment_system_id = $_SESSION['hostcmsOrder']['shop_payment_system_id'] = intval(Core_Array::getPost('shop_payment_system_id', 0));

        // Если выбрана платежная система
        if ($_SESSION['hostcmsOrder']['shop_payment_system_id']) {
            Shop_Payment_System_Handler::factory(
                            Core_Entity::factory('Shop_Payment_System', $shop_payment_system_id)
                    )
                    ->orderParams($_SESSION['hostcmsOrder'])
                    ->execute();
        } else {
            ?><h1>Ошибка! Не указана ни одна платежная система.</h1><?php
        }
        break;
    default:
         
   
      
}
#
Re: Обьединил первый шаг корзины с таблицей товаров. Не работает кнопка пересчитать
PakoGonsalezZ,
Посмотрите как работает кнопка "Пересчет" на Демо сайте http://demo.hostcms.ru/shop/cart/ После пересчета не куда не должны уходить а пересчитать корзину на месте! Думаю это логично.
E-mail: info@syrbek.ru / телега: @syrbek /skype: activexm / syrbek.ru / Поддержка сайтов / г. Москва [HTML, CSS (Bootstrap), JS(JQuery, ExtJS), PHP, MySQL, MSSql, Posgres, Git, SVN, Redmine]
#
Re: Обьединил первый шаг корзины с таблицей товаров. Не работает кнопка пересчитать
Решилось, путем добавления значения шага 1 при пересчете
if (isset($_POST['recount']) || !isset($_POST['step'])){
   $_POST['step'] = 1;
}
И убрал отсюда передачу значения пересчета switch (Core_Array::getPost('step')
Заработало все нормально
Прост опо сути всегда должно перекидывать на 1 страницу, вместо ветки default
#
Re: Обьединил первый шаг корзины с таблицей товаров. Не работает кнопка пересчитать
PakoGonsalezZ,
По мне наоборот было бы удобнее организовать это в default учитывая что туда приходят те же запросы:
switch (Core_Array::getPost('recount') || !count($aShop_Cart) ? 0 : Core_Array::getPost('step')) {
E-mail: info@syrbek.ru / телега: @syrbek /skype: activexm / syrbek.ru / Поддержка сайтов / г. Москва [HTML, CSS (Bootstrap), JS(JQuery, ExtJS), PHP, MySQL, MSSql, Posgres, Git, SVN, Redmine]
Авторизация