Exemplo n.º 1
0
 public static function print_order_preferences()
 {
     $table = new Cli\Table();
     $table->setHeaders(array('Key', 'Configuration', 'Value'));
     $line = array('PS_ORDER_PROCESS_TYPE', 'Checkout process');
     $orderType = Configuration::get('PS_ORDER_PROCESS_TYPE');
     if ($orderType == PS_ORDER_PROCESS_STANDARD) {
         array_push($line, 'Standard');
     } else {
         array_push($line, 'One page checkout');
     }
     $table->addRow($line);
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_GUEST_CHECKOUT_ENABLED', 'Allow guest visitors to place orders');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_DISALLOW_HISTORY_REORDERING', 'Disable one click reorder');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_ALLOW_MULTISHIPPING', 'Allow shipping to multiple addresses');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_SHIP_WHEN_AVAILABLE', 'Allow shipping delay');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_CONDITIONS', 'Require customers to accept terms of service');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_PURCHASE_MINIMUM', 'Minimum purchase total required (0=disabled)');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_CONDITIONS_CMS_ID', 'Store\'s condition of use page ID');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_GIFT_WRAPPING', 'Offer gift wrapping');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_GIFT_WRAPPING_PRICE', 'Gift wrapping price');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_GIFT_WRAPPING_TAX_RULES_GROUP', 'tax group for gift wrapping');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_RECYCLE_PACK', 'Suggest recycled packaging');
     $table->display();
 }
Exemplo n.º 2
0
 public static function show_status()
 {
     $table = new Cli\Table();
     $table->setHeaders(array('Key', 'Configuration', 'Value'));
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_CATALOG_MODE', 'Enable PS catalog mode');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_COMPARATOR_MAX_ITEM', 'Max selection for products comparison');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_NB_DAYS_NEW_PRODUCT', 'Number of days for which a product is considered new');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_CART_REDIRECT', 'Redirect after adding product to cart');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_PRODUCT_SHORT_DESC_LIMIT', 'Maximum product short description size');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_QTY_DISCOUNT_ON_COMBINATION', 'How to calculate quantity discounts (0=products, 1=combination)');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_FORCE_FRIENDLY_PRODUCT', 'update friendly url on every save');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_PRODUCTS_PER_PAGE', 'Number of products per page');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_PRODUCTS_ORDER_BY', 'Products sorted by (0=name, 1=price, 2=add date, 3=modification date, 4=position category, 5=manufacturer, 6=Qtty, 7=reference)');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_PRODUCTS_ORDER_WAY', 'Default order method (0=asc, 1=desc)');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_DISPLAY_QTIES', 'Display available quantities');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_LAST_QTIES', 'Display remaining when lower than:');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_DISPLAY_JQZOOM', 'Enable Jqzoom on product page');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_DISP_UNAVAILABLE_ATTR', 'Display unavailable products');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_ATTRIBUTE_CATEGORY_DISPLAY', 'Display add to cart button when product has attributes');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_ATTRIBUTE_ANCHOR_SEPARATOR', 'Separator of attribute anchor on product links');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_DISPLAY_DISCOUNT_PRICE', 'Display the new price with applied discount');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_ORDER_OUT_OF_STOCK', 'Display add to cart on unavailable products');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_STOCK_MANAGEMENT', 'Enable stock management');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_ADVANCED_STOCK_MANAGEMENT', 'Enabled advanced stock management');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_FORCE_ASM_NEW_PRODUCT', 'New products use advanced stock management');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_DEFAULT_WAREHOUSE_NEW_PRODUCT', 'Default warehouse of new products');
     $table->display();
     return;
 }
Exemplo n.º 3
0
 public function run()
 {
     $arguments = PS_CLI_ARGUMENTS::getArgumentsInstance();
     $interface = PS_CLI_INTERFACE::getInterface();
     if ($arguments->getOpt('show-status')) {
         $table = new Cli\Table();
         $table->setHeaders(array('Key', 'Configuration', 'Value'));
         PS_CLI_UTILS::add_configuration_value($table, 'PS_UPGRADE_CHANNEL', 'PrestaShop upgrade Channel');
         $interface->add_table($table);
     } else {
         $interface->add_content("Not implemented");
         $interface->set_ret_value(1);
     }
 }
Exemplo n.º 4
0
 public static function show_status()
 {
     $table = new Cli\Table();
     $table->setHeaders(array('Key', 'Configuration', 'Value'));
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_REWRITING_SETTINGS', 'Support Url rewriting');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_ALLOW_ACCENTED_CHARS_URL', 'Allow accented in characters in URL');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_CANONICAL_REDIRECT', 'Redirect to canonical URL (0= no redirection, 1= 302, 2 = 301)');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_HTACCESS_DISABLE_MULTIVIEWS', 'Disable Apache mutliview');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_HTACCESS_DISABLE_MODSEC', 'Disable Apache mod security');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_SHOP_DOMAIN', 'Shop domain');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_SHOP_DOMAIN_SSL', 'Shop domain SSL');
     $context = Context::getContext();
     $line = array('-', 'Default URI');
     $url = ShopUrl::getShopUrls($context->shop->id)->where('main', '=', 1)->getFirst();
     array_push($line, $url->physical_uri);
     $table->addRow($line);
     $table->display();
     return;
 }
Exemplo n.º 5
0
 public function run()
 {
     $arguments = PS_CLI_Arguments::getArgumentsInstance();
     $status = NULL;
     if ($arguments->getOpt('enable', false)) {
         $successMsg = 'Maintenance mode disabled';
         $errMsg = 'Could not disable maintenance mode';
         $notChanged = 'Maintenance mode was already disabled';
         PS_CLI_UTILS::update_global_value('PS_SHOP_ENABLE', true, $successMsg, $errMsg, $notChanged);
     } elseif ($opt = $arguments->getOpt('disable', false)) {
         $successMsg = 'Maintenance mode enabled';
         $errMsg = 'Could not enable maintenance mode';
         $notChanged = 'Maintenance mode was already enabled';
         PS_CLI_UTILS::update_global_value('PS_SHOP_ENABLE', false, $successMsg, $errMsg, $notChanged);
     } else {
         $arguments->show_command_usage('shop');
         exit(1);
     }
     if ($status === false) {
         exit(1);
     }
     exit(0);
 }
Exemplo n.º 6
0
 public static function show_preferences_status()
 {
     $table = new Cli\Table();
     $activities = array(2 => 'Animals and Pets', 3 => 'Art and Culture', 4 => 'Babies', 5 => 'Beauty and Personal Care', 6 => 'Cars', 7 => 'Computer Hardware and Software', 8 => 'Download', 9 => 'Fashion and accessories', 10 => 'Flowers, Gifts and Crafts', 11 => 'Food and beverage', 12 => 'HiFi, Photo and Video', 13 => 'Home and Garden', 14 => 'Home Appliances', 15 => 'Jewelry', 1 => 'Lingerie and Adult', 16 => 'Mobile and Telecom', 17 => 'Services', 18 => 'Shoes and accessories', 19 => 'Sport and Entertainment', 20 => 'Travel');
     $table->setHeaders(array('Key', 'Configuration', 'Value'));
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_TOKEN_ENABLE', 'Front office tokens');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_ALLOW_HTML_IFRAME', 'Allow HTML iframes');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_USE_HTMLPURIFIER', 'Use HTML purifier library');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_DISPLAY_SUPPLIERS', 'Enable FO suppliers and manufacturers page');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_DISPLAY_BEST_SELLERS', 'Enable FO Best Sellers page');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_COOKIE_CHECKIP', 'Check cookie IP address');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_COOKIE_LIFETIME_FO', 'Front office cookie lifetime');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_COOKIE_LIFETIME_BO', 'Back office cookie lifetime');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_LIMIT_UPLOAD_FILE_VALUE', 'Maximum upload size (MB)');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_LIMIT_UPLOAD_IMAGE_VALUE', 'Maximum image upload size (MB)');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_ATTACHMENT_MAXIMUM_SIZE', 'Maximum attachment size (MB)');
     $line = array('PS_PRICE_ROUND_MODE', 'Round mode (0=superior, 1=inferior, 2=classic)');
     $roundMode = Configuration::get('PS_PRICE_ROUND_MODE');
     switch ($roundMode) {
         case 0:
             array_push($line, 'Superior');
             break;
         case 1:
             array_push($line, 'Inferior');
             break;
         case 2:
             array_push($line, 'Classic');
             break;
     }
     $table->addRow($line);
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_SSL_ENABLED', 'Force SSL on all pages');
     $shopActivity = Configuration::get('PS_SHOP_ACTIVITY');
     $line = array('PS_SHOP_ACTIVITY', 'Shop activity', $activities[$shopActivity] . " [{$shopActivity}]");
     $table->addRow($line);
     $table->display();
 }
Exemplo n.º 7
0
 public function show_status()
 {
     $table = new Cli\Table();
     $table->setHeaders(array('Key', 'Configuration', 'Value'));
     PS_CLI_UTILS::add_configuration_value($table, 'PS_MAIL_EMAIL_MESSAGE', 'Email method');
     $type = Configuration::get('PS_MAIL_TYPE');
     switch ($type) {
         case Mail::TYPE_HTML:
             $typeName = 'HTML';
             break;
         case Mail::TYPE_TEXT:
             $typeName = 'Text';
             break;
         case Mail::TYPE_BOTH:
             $typeName = 'Both';
             break;
         default:
             $typeName = '';
             break;
     }
     $table->addRow(array('PS_MAIL_TYPE', "Email Type (" . Mail::TYPE_HTML . " for HTML, " . Mail::TYPE_TEXT . " for text, " . Mail::TYPE_BOTH . " for both)", $type . ' (' . $typeName . ')'));
     PS_CLI_UTILS::add_configuration_value($table, 'PS_MAIL_DOMAIN', 'Mail domain name');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_SHOP_EMAIL', 'Shop email');
     //todo
     $mailMethod = Configuration::get('PS_MAIL_METHOD');
     switch ($mailMethod) {
         case self::MAIL_PHP:
             $methodName = 'PHP mail()';
             break;
         case self::MAIL_SMTP:
             $methodName = 'SMTP';
             break;
         case self::MAIL_DISABLED:
             $methodName = 'Disabled';
             break;
         default:
             $methodName = '';
             break;
     }
     $table->addRow(array('PS_MAIL_METHOD', 'Email method (' . self::MAIL_PHP . ' for php mail(), ' . self::MAIL_SMTP . ' for smtp, ' . self::MAIL_DISABLED . ' for disabled)', $mailMethod . ' (' . $methodName . ')'));
     PS_CLI_UTILS::add_configuration_value($table, 'PS_MAIL_SERVER', 'Email server');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_MAIL_USER', 'Email user');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_MAIL_PASSWD', 'Email password');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_MAIL_SMTP_ENCRYPTION', 'SMTP encryption (off, tls or ssl)');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_MAIL_SMTP_PORT', 'SMTP port');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_LOG_EMAILS', 'Logs emails');
     $table->display();
 }
Exemplo n.º 8
0
 public static function show_status()
 {
     $table = new Cli\Table();
     $table->setHeaders(array('Key', 'Configuration', 'Value'));
     PS_CLI_UTILS::add_configuration_value($table, 'PS_REGISTRATION_PROCESS_TYPE', 'Registration type (0=only account; 1=account and address)');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_ONE_PHONE_AT_LEAST', 'Customer have to provide at least one phone number');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_CART_FOLLOWING', 'Recall last shopping cart');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_CUSTOMER_CREATION_EMAIL', 'Send an email with account information');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_PASSWD_TIME_FRONT', 'Minimum time between two passwords resets');
     PS_CLI_UTILS::add_boolean_configuration_status($table, 'PS_B2B_ENABLE', 'B2B mode');
     $table->display();
 }
Exemplo n.º 9
0
 public static function show_status()
 {
     $table = new Cli\Table();
     $table->setHeaders(array('Key', 'Configuration', 'Value'));
     PS_CLI_UTILS::add_configuration_value($table, 'PS_IMAGE_QUALITY', 'Image format (jpg, png, png_all)');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_JPEG_QUALITY', 'Jpeg compression (0-100)');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_PNG_QUALITY', 'Jpeg compression (0-9)');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_IMAGE_GENERATION_METHOD', '(0=auto, 1=width, 2=height)');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_PRODUCT_PICTURE_MAX_SIZE', 'Maximum file size of customer pictures (in bytes)');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_PRODUCT_PICTURE_WIDTH', 'Width of product pictures custumers can upload (in px)');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_PRODUCT_PICTURE_HEIGHT', 'Height of product pictures custumers can upload (in px)');
     $table->display();
     return;
 }
Exemplo n.º 10
0
require_once PS_CLI_ROOT . '/PS_CLI/ps-cli_command.php';
/*
 * Load 3d party librairies
 */
//php-cli-tools
require_once PS_CLI_ROOT . '/lib/php-cli-tools/load-php-cli-tools.php';
//garden-cli argument parser
require_once PS_CLI_ROOT . '/lib/garden-cli/Args.php';
require_once PS_CLI_ROOT . '/lib/garden-cli/Cli.php';
require_once PS_CLI_ROOT . '/lib/garden-cli/Table.php';
$conf = PS_CLI_CONFIGURE::getConfigurationInstance();
$conf->preload_configure();
$arguments = PS_CLI_ARGUMENTS::getArgumentsInstance();
$arguments->parse_arguments();
//load ps core
PS_CLI_UTILS::ps_cli_load_ps_core();
$conf->postload_configure();
$interface = PS_CLI_INTERFACE::getInterface();
// todo: create a runner and export this code in it; we'll need to create an interface instance before
//find what to run
try {
    $arguments->runArgCommand();
} catch (Exception $e) {
    $interface->add_exception($e);
} catch (PrestaShopException $e) {
    $interface->add_exception($e);
} catch (PrestaShopDatabaseException $e) {
    $interface->add_exception($e);
} catch (PrestaShopModuleException $e) {
    $interface->add_exception($e);
} catch (PrestaShopPaymentException $e) {
Exemplo n.º 11
0
 public static function print_employee_options()
 {
     $table = new Cli\Table();
     $table->setHeaders(array('Key', 'Configuration', 'Value'));
     PS_CLI_UTILS::add_configuration_value($table, 'PS_PASSWD_TIME_BACK', 'Minimum delay for password regeneration');
     PS_CLI_UTILS::add_configuration_value($table, 'PS_BO_ALLOW_EMPLOYEE_FORM_LANG', 'Memorize last used language in forms');
     $table->display();
 }