Exemple #1
0
                $smarty->assign("yandex_filesize", (string) round(filesize("core/temp/yandex.xml") / 1024));
            }
        }
        if (!isset($_POST["yandex_export"])) {
            $_POST["yandex_export"] = '';
        }
        if ($_POST["yandex_export"]) {
            $_SESSION["yandsess"] = $_POST["categories_select"];
            $rurrate = (double) $_POST["yandex_rur_rate"];
            $yandex_export_product_name = isset($_POST['yandex_export_product_name']) ? $_POST['yandex_export_product_name'] : 'only_name';
            if ($rurrate <= 0) {
                $smarty->assign("yandex_errormsg", "Курс рубля указан неверно. Пожалуйста, вводите положительное число");
            } else {
                if (file_exists("core/temp/yandex.xml")) {
                    unlink("core/temp/yandex.xml");
                }
                $f = @fopen("core/temp/yandex.xml", "w");
                if ($f) {
                    _exportToYandexMarket($f, $rurrate, $yandex_export_product_name, $_POST["categories_select"]);
                    fclose($f);
                    Redirect(ADMIN_FILE . "?dpt=modules&sub=yandex&yandex_export_successful=yes");
                } else {
                    $smarty->assign("yandex_errormsg", "Ошибка при создании файла yandex.xml");
                }
            }
        }
        $_SESSION["yandsess"] = isset($_SESSION["yandsess"]) && count($_SESSION["yandsess"]) > 0 ? $_SESSION["yandsess"] : array(0);
        $smarty->assign("admin_sub_dpt", "modules_yandex.tpl");
        $smarty->assign("yandsess", $_SESSION["yandsess"]);
    }
}
Exemple #2
0
        // var_dump(str_replace('/home/aqq7507/public_html/', 'http://',$pix[0]));exit();
        if ($pic_row) {
            //if ( strlen($pic_row["filename"]) && file_exists("./products_pictures/".$pic_row["filename"]) )
            fputs($f, "\t\t\t\t\t\t<picture>" . str_replace('/home/aqq7507/public_html/', 'http://', $pix[0]) . "</picture>\n");
        }
        //$product["product"]		= $_NameAddi._deleteHTML_Elements( $product["product"] );
        fputs($f, "\t\t\t\t\t\t<name>" . $product["product"] . "</name>\n");
        if (strlen($dsc) > 0) {
            //						$product[$dsc] = _deleteHTML_Elements( $product[$dsc] );
            $product["product"] = strip_tags($product["product"]);
            fputs($f, "\t\t\t\t\t\t<description>" . $product["product"] . "</description>\n");
        } else {
            fputs($f, "\t\t\t\t\t\t<description></description>\n");
        }
        fputs($f, "\t\t\t\t\t</offer>\n");
    }
    //}
    fputs($f, "\t\t\t\t</offers>\n");
}
function _exportEnd($f)
{
    fputs($f, "\t\t\t</shop>\n");
    fputs($f, "\t\t</yml_catalog>\n");
}
$rurrate = 30;
$yandex_export_product_name = 'only_name';
$f = fopen("/home/aqq7507/public_html/lindero.ru/temp/yandex.xml", "w");
if ($f) {
    _exportToYandexMarket($f, $rurrate, $yandex_export_product_name);
    fclose($f);
}