/** * Формирование ЧПУ для модуля Магазин * * @param string $string обрабатываемый текст * @return string обработанный текст */ function _shopRewrite($string) { if (REWRITE_MODE) { $string = shopRewrite($string); } return $string; }
// вылюты $AVE_YML->ymlElementCurrencySet($shop_currency_id, 1); $AVE_YML->ymlElementCurrencySet('USD', 'CBRF', 3); $AVE_YML->ymlElementCurrencySet('UAH', 'NBU', 1); // категории $sql = mysql_query("\n\tSELECT\n\t\tId,\n\t\tparent_id,\n\t\tKatName\n\tFROM " . PREFIX . "_modul_shop_kategorie\n"); while (list($cat_id, $cat_parent_id, $cat_name) = mysql_fetch_row($sql)) { if ($cat_parent_id) { $AVE_YML->ymlElementCategorySet($cat_name, $cat_id, $cat_parent_id); } else { $AVE_YML->ymlElementCategorySet($cat_name, $cat_id); } } // товарные предложения //if ($downloadable) ? "IF(VersandZeitId == " . $downloadable . ", 'true', 'false') AS downloadable," : ""; $sql = mysql_query("\n\tSELECT\n\t\tart.Id AS url,\n\t\tPreis AS price,\n\t\t'" . $shop_currency_id . "' AS currencyId,\n\t\tKatId AS categoryId,\n\t\tart.Bild AS picture,\n\t\t'true' AS delivery,\n\t\tArtName AS name,\n\t\tvend.Name AS vendor,\n\t\tArtNr AS vendorCode,\n\t\tTextLang AS description,\n\t\t" . ($custom ? "IF(VersandZeitId = " . $custom . ", 0, 1)" : 1) . " AS available,\n\t\t" . ($downloadable ? "IF(VersandZeitId = " . $downloadable . ", 'true', 'false') AS downloadable," : '') . "\n\t\tparent_id\n\tFROM\n\t\t" . PREFIX . "_modul_shop_artikel AS art\n\tLEFT JOIN\n\t\t" . PREFIX . "_modul_shop_hersteller AS vend\n\t\t\tON vend.Id = Hersteller\n\tLEFT JOIN\n\t\t" . PREFIX . "_modul_shop_kategorie AS cat\n\t\t\tON cat.Id = KatId\n\tWHERE\n\t\tstatus = 1\n\tAND\n\t\t(Lager > 0" . ($custom ? " OR VersandZeitId = " . $custom : '') . ")\n\tAND\n\t\tErschienen <= " . time() . "\n\tAND\n\t\tPreis != '0.00'\n"); while ($row = mysql_fetch_assoc($sql)) { $offer_id = $row['url']; $row['url'] = HOME_URL . shopRewrite("index.php?module=shop&action=product_detail" . "&product_id=" . $offer_id . "&categ=" . $row['categoryId'] . "&navop=" . (0 == $row['parent_id'] ? $row['categoryId'] : $row['parent_id'])) . ($track_label ? "#ym" : ""); if (empty($row['picture'])) { unset($row['picture']); } else { $row['picture'] = HOME_URL . 'modules/shop/uploads/' . $row['picture']; } $offer_available = $row['available']; unset($row['available'], $row['parent_id']); $AVE_YML->ymlElementOfferSet($offer_id, $row, $offer_available); } mysql_free_result($sql); header('Content-type: text/xml'); print_r($AVE_YML->ymlGet());