Beispiel #1
0
         }
         $json = json_encode($return_data);
         echo $json;
         exit;
     }
     break;
 case 'update_products_status':
     if ($this->ADMIN_USER) {
         if (is_numeric($this->post['products_id'])) {
             $str = "select products_id,products_status from tx_multishop_products where products_id='" . $this->post['products_id'] . "'";
             $qry = $GLOBALS['TYPO3_DB']->sql_query($str);
             $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry);
             if ($row['products_id']) {
                 switch ($row['products_status']) {
                     case '0':
                         mslib_befe::enableProduct($row['products_id']);
                         $new_value = 1;
                         break;
                     case '1':
                         mslib_befe::disableProduct($row['products_id']);
                         $new_value = 0;
                         break;
                 }
                 $item = array();
                 $item['html'] = $new_value;
                 $json = mslib_befe::array2json($item);
                 echo $json;
             }
         }
     }
     exit;
        }
    }
}
if (!$this->ms['MODULES']['DISABLE_REALTIME_CHECK_PRODUCTS_STARTTIME_ENDTIME']) {
    if (is_numeric($this->get['categories_id']) && $this->get['categories_id'] > 0) {
        $sql = 'select p.products_id, p.starttime, p.endtime, p.products_status from tx_multishop_products p, tx_multishop_products_to_categories p2c where p.products_id=p2c.products_id and p2c.categories_id=\'' . $this->get['categories_id'] . '\' and p2c.is_deepest=1 and (p.starttime>0 or p.endtime>0)';
        $qry = $GLOBALS['TYPO3_DB']->sql_query($sql);
        if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry) > 0) {
            $current_tstamp = time();
            while ($rs_product = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry)) {
                if ($rs_product['starttime'] > 0) {
                    if ($rs_product['products_status'] == '1' && $rs_product['starttime'] > $current_tstamp) {
                        mslib_befe::disableProduct($rs_product['products_id']);
                    } else {
                        if ($rs_product['products_status'] == '0' && $product['starttime'] <= $current_tstamp) {
                            mslib_befe::enableProduct($rs_product['products_id']);
                        }
                    }
                }
                if ($rs_product['products_status'] == '1' && $rs_product['endtime'] > 0) {
                    if ($rs_product['endtime'] <= $current_tstamp) {
                        mslib_befe::disableProduct($rs_product['products_id']);
                    }
                }
            }
        }
    }
}
if (is_numeric($this->get['products_id'])) {
    // overwrite multishop settings loaded from the product
    $product = mslib_fe::getProduct($this->get['products_id'], $this->get['categories_id'], 'p.custom_settings', 1, 1);