diff --git a/.dev/macro/core.php b/.dev/macro/core.php index 4ad634daad..7433d15663 100644 --- a/.dev/macro/core.php +++ b/.dev/macro/core.php @@ -18,11 +18,9 @@ * * @category LiteCommerce * @author Creative Development LLC - * @copyright Copyright (c) 2011 Creative Development LLC . All rights reserved + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @link http://www.litecommerce.com/ - * @see ____file_see____ - * @since 1.0.18 */ define('MACRO_START_DIR', getcwd()); @@ -52,8 +50,6 @@ * @param string $msg Error message * * @return void - * @see ____func_see____ - * @since 1.0.18 */ function macro_error($msg) { @@ -67,8 +63,6 @@ function macro_error($msg) * @param string $name Name * * @return string - * @see ____func_see____ - * @since 1.0.18 */ function macro_get_named_argument($name) { @@ -83,8 +77,6 @@ function macro_get_named_argument($name) * @param integer $number Index * * @return string - * @see ____func_see____ - * @since 1.0.18 */ function macro_get_plain_argument($number) { @@ -97,8 +89,6 @@ function macro_get_plain_argument($number) * @param string $path Path * * @return string - * @see ____func_see____ - * @since 1.0.18 */ function macro_convert_path_to_class_name($path) { @@ -111,8 +101,6 @@ function macro_convert_path_to_class_name($path) * @param string $class Class name * * @return string - * @see ____func_see____ - * @since 1.0.18 */ function macro_convert_class_name_to_path($class) { @@ -126,8 +114,6 @@ function macro_convert_class_name_to_path($class) * @param string $data File content * * @return void - * @see ____func_see____ - * @since 1.0.18 */ function macro_file_put_contents($path, $data) { @@ -146,8 +132,6 @@ function macro_file_put_contents($path, $data) * @param string $path path * * @return boolean - * @see ____func_see____ - * @since 1.0.18 */ function macro_is_entity($path) { @@ -162,8 +146,6 @@ function macro_is_entity($path) * @param string $moduleName Module name OPTIONAL * * @return string - * @see ____func_see____ - * @since 1.0.24 */ function macro_assemble_class_name($suffix, $moduleAuthor = null, $moduleName = null) { @@ -180,8 +162,6 @@ function macro_assemble_class_name($suffix, $moduleAuthor = null, $moduleName = * @param string $moduleName Module name OPTIONAL * * @return string - * @see ____func_see____ - * @since 1.0.24 */ function macro_assemble_tpl_name($suffix, $moduleAuthor = null, $moduleName = null) { @@ -196,8 +176,6 @@ function macro_assemble_tpl_name($suffix, $moduleAuthor = null, $moduleName = nu * @param string $class Class full name * * @return string - * @see ____func_see____ - * @since 1.0.24 */ function macro_get_class_short_name($class) { @@ -212,8 +190,6 @@ function macro_get_class_short_name($class) * @param string $camel Camel case string * * @return string - * @see ____func_see____ - * @since 1.0.24 */ function macro_convert_camel_to_human_readable($camel) { @@ -233,8 +209,6 @@ function macro_convert_camel_to_human_readable($camel) * @param string &$path Path * * @return void - * @see ____func_see____ - * @since 1.0.18 */ function macro_check_file_path(&$path) { @@ -255,8 +229,6 @@ function macro_check_file_path(&$path) * @param string $path Path * * @return void - * @see ____func_see____ - * @since 1.0.18 */ function macro_check_class_file_path($path) { @@ -273,8 +245,6 @@ function macro_check_class_file_path($path) * @param string &$class Class * * @return void - * @see ____func_see____ - * @since 1.0.18 */ function macro_check_class(&$class) { @@ -290,8 +260,6 @@ function macro_check_class(&$class) * @param string $module Name * * @return void - * @see ____func_see____ - * @since 1.0.18 */ function macro_check_module($author, $module) { @@ -315,8 +283,6 @@ function macro_check_module($author, $module) * @param string $path Path * * @return string - * @see ____func_see____ - * @since 1.0.18 */ function macro_get_file_header($path) { @@ -341,11 +307,9 @@ function macro_get_file_header($path) * * @category LiteCommerce * @author Creative Development LLC - * @copyright Copyright (c) 2011 Creative Development LLC . All rights reserved + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @link http://www.litecommerce.com/ - * @see ____file_see____ - * @since 1.0.0 */ @@ -358,8 +322,6 @@ function macro_get_file_header($path) * @param string $path Path * * @return string - * @see ____func_see____ - * @since 1.0.18 */ function macro_get_class_repo_header($path) { @@ -381,8 +343,6 @@ function macro_get_class_repo_header($path) * @param string $path Path * * @return string - * @see ____func_see____ - * @since 1.0.18 */ function macro_get_class_header($path) { @@ -396,8 +356,6 @@ function macro_get_class_header($path) /** * Abstract widget * - * @see ____class_see____ - * @since 1.0.0 */ HEAD; } diff --git a/.dev/macro/create-crud-list.php b/.dev/macro/create-crud-list.php index 4893b7f681..c5ba1623d3 100755 --- a/.dev/macro/create-crud-list.php +++ b/.dev/macro/create-crud-list.php @@ -19,11 +19,9 @@ * * @category LiteCommerce * @author Creative Development LLC - * @copyright Copyright (c) 2011 Creative Development LLC . All rights reserved + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @link http://www.litecommerce.com/ - * @see ____file_see____ - * @since 1.0.0 */ /** @@ -225,8 +223,6 @@ function($var) use ($targetOneControllerPath) { /** * $targetHumanReadableName controller * - * @see ____class_see____ - * @since 1.0.0 */ class $targetShort extends \\XLite\\Controller\\Admin\\AAdmin { @@ -240,8 +236,6 @@ class $targetShort extends \\XLite\\Controller\\Admin\\AAdmin * Update list * * @return void - * @see ____func_see____ - * @since 1.0.0 */ protected function doActionUpdate() { @@ -262,8 +256,6 @@ protected function doActionUpdate() * @param string \$paramName Parameter name * * @return mixed - * @see ____func_see____ - * @since 1.0.0 */ public function getCondition(\$paramName) { @@ -278,8 +270,6 @@ public function getCondition(\$paramName) * Save search conditions * * @return void - * @see ____func_see____ - * @since 1.0.0 */ protected function doActionSearch() { @@ -292,8 +282,6 @@ protected function doActionSearch() * Return search parameters * * @return array - * @see ____func_see____ - * @since 1.0.0 */ protected function getSearchParams() { @@ -314,8 +302,6 @@ protected function getSearchParams() * Get search conditions * * @return array - * @see ____func_see____ - * @since 1.0.0 */ protected function getConditions() { @@ -358,8 +344,6 @@ protected function getConditions() /** * $targetHumanReadableName page view * - * @see ____class_see____ - * @since 1.0.0 * * @ListChild (list="admin.center", zone="admin") */ @@ -369,8 +353,6 @@ class $targetShort extends \\XLite\\View\\AView * Return list of allowed targets * * @return array - * @see ____func_see____ - * @since 1.0.0 */ public static function getAllowedTargets() { @@ -381,8 +363,6 @@ public static function getAllowedTargets() * Return widget default template * * @return string - * @see ____func_see____ - * @since 1.0.0 */ protected function getDefaultTemplate() { @@ -393,8 +373,6 @@ protected function getDefaultTemplate() * Check - search box is visible or not * * @return boolean - * @see ____func_see____ - * @since 1.0.0 */ protected function isSearchVisible() { @@ -424,10 +402,9 @@ protected function isSearchVisible() * $targetHumanReadableName page template * * @author Creative Development LLC - * @copyright Copyright (c) 2011 Creative Development LLC . All rights reserved + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @link http://www.litecommerce.com/ - * @since 1.0.0 *} @@ -467,10 +444,9 @@ protected function isSearchVisible() * $targetHumanReadableName list search template * * @author Creative Development LLC - * @copyright Copyright (c) 2011 Creative Development LLC . All rights reserved + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @link http://www.litecommerce.com/ - * @since 1.0.0 *} @@ -498,8 +474,6 @@ protected function isSearchVisible() /** * $targetHumanReadableName list search form * - * @see ____class_see____ - * @since 1.0.0 */ class $formListSearchClassShort extends \\XLite\\View\\Form\\AForm { @@ -507,8 +481,6 @@ class $formListSearchClassShort extends \\XLite\\View\\Form\\AForm * Return default value for the "target" parameter * * @return string - * @see ____func_see____ - * @since 1.0.0 */ protected function getDefaultTarget() { @@ -519,8 +491,6 @@ protected function getDefaultTarget() * Return default value for the "action" parameter * * @return string - * @see ____func_see____ - * @since 1.0.0 */ protected function getDefaultAction() { @@ -555,10 +525,9 @@ protected function getDefaultAction() * $fieldHumanReadable condition * * @author Creative Development LLC - * @copyright Copyright (c) 2011 Creative Development LLC . All rights reserved + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @link http://www.litecommerce.com/ - * @since 1.0.0 * * @ListChild (list="$itemsListViewList.search.conditions", weight="$weight") *} @@ -586,10 +555,9 @@ protected function getDefaultAction() * Search button * * @author Creative Development LLC - * @copyright Copyright (c) 2011 Creative Development LLC . All rights reserved + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @link http://www.litecommerce.com/ - * @since 1.0.0 * * @ListChild (list="$itemsListViewList.search.conditions", weight="last") *} @@ -621,10 +589,9 @@ protected function getDefaultAction() * $targetHumanReadableName list table template * * @author Creative Development LLC - * @copyright Copyright (c) 2011 Creative Development LLC . All rights reserved + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @link http://www.litecommerce.com/ - * @since 1.0.0 *} @@ -650,8 +617,6 @@ protected function getDefaultAction() /** * $targetHumanReadableName list table form * - * @see ____class_see____ - * @since 1.0.0 */ class $formListTableClassShort extends \\XLite\\View\\Form\\ItemsList\\AItemsList { @@ -659,8 +624,6 @@ class $formListTableClassShort extends \\XLite\\View\\Form\\ItemsList\\AItemsLis * Return default value for the "target" parameter * * @return string - * @see ____func_see____ - * @since 1.0.0 */ protected function getDefaultTarget() { @@ -671,8 +634,6 @@ protected function getDefaultTarget() * Return default value for the "action" parameter * * @return string - * @see ____func_see____ - * @since 1.0.0 */ protected function getDefaultAction() { @@ -701,8 +662,6 @@ protected function getDefaultAction() /** * $targetHumanReadableName items list * - * @see ____class_see____ - * @since 1.0.0 */ class $itemsListClassShort extends \\XLite\\View\\ItemsList\\Model\\Table { @@ -745,8 +704,6 @@ class $itemsListClassShort extends \\XLite\\View\\ItemsList\\Model\\Table * Get a list of CSS files required to display the widget properly * * @return array - * @see ____func_see____ - * @since 1.0.0 */ public function getCSSFiles() { @@ -769,8 +726,6 @@ public function getCSSFiles() * Define widget parameters * * @return void - * @see ____func_see____ - * @since 1.0.0 */ protected function defineWidgetParams() { @@ -801,8 +756,6 @@ protected function defineWidgetParams() * Define columns structure * * @return array - * @see ____func_see____ - * @since 1.0.0 */ protected function defineColumns() { @@ -843,8 +796,6 @@ protected function defineColumns() * Define repository name * * @return string - * @see ____func_see____ - * @since 1.0.0 */ protected function defineRepositoryName() { @@ -860,8 +811,6 @@ protected function defineRepositoryName() * Get create entity URL * * @return string - * @see ____func_see____ - * @since 1.0.0 */ protected function getCreateURL() { @@ -878,8 +827,6 @@ protected function getCreateURL() * Get create button label * * @return string - * @see ____func_see____ - * @since 1.0.0 */ protected function getCreateButtonLabel() { @@ -895,8 +842,6 @@ protected function getCreateButtonLabel() * Inline creation mechanism position * * @return integer - * @see ____func_see____ - * @since 1.0.0 */ protected function isInlineCreation() { @@ -924,8 +869,6 @@ protected function isInlineCreation() * Mark list as removable * * @return boolean - * @see ____func_see____ - * @since 1.0.0 */ protected function isRemoved() { @@ -942,8 +885,6 @@ protected function isRemoved() * Mark list as switchyabvle (enable / disable) * * @return boolean - * @see ____func_see____ - * @since 1.0.0 */ protected function isSwitchable() { @@ -960,8 +901,6 @@ protected function isSwitchable() * Mark list as sortable * * @return integer - * @see ____func_see____ - * @since 1.0.0 */ protected function getSortableType() { @@ -989,8 +928,6 @@ protected function getSortableType() * Get container class * * @return string - * @see ____func_see____ - * @since 1.0.0 */ protected function getContainerClass() { @@ -1008,8 +945,6 @@ protected function getContainerClass() * Get panel class * * @return \XLite\View\Base\FormStickyPanel - * @see ____func_see____ - * @since 1.0.0 */ protected function getPanelClass() { @@ -1027,8 +962,6 @@ protected function getPanelClass() * Return class name for the list pager * * @return string - * @see ____func_see____ - * @since 1.0.0 */ protected function getPagerClass() { @@ -1048,8 +981,6 @@ protected function getPagerClass() * Return search parameters. * * @return array - * @see ____func_see____ - * @since 1.0.0 */ static public function getSearchParams() { @@ -1076,8 +1007,6 @@ static public function getSearchParams() * Define so called "request" parameters * * @return void - * @see ____func_see____ - * @since 1.0.0 */ protected function defineRequestParams() { @@ -1102,8 +1031,6 @@ protected function defineRequestParams() * TODO refactor * * @return \XLite\Core\CommonCell - * @see ____func_see____ - * @since 1.0.0 */ protected function getSearchCondition() { @@ -1142,10 +1069,9 @@ protected function getSearchCondition() * $targetHumanReadableName list styles * * @author Creative Development LLC - * @copyright Copyright (c) 2011 Creative Development LLC . All rights reserved + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @link http://www.litecommerce.com/ - * @since 1.0.0 */ CODE; @@ -1170,8 +1096,6 @@ protected function getSearchCondition() /** * $targetHumanReadableName items list's sticky panel * - * @see ____class_see____ - * @since 1.0.0 */ class $itemsListPanelClassShort extends \\XLite\\View\\StickyPanel\\ItemsListForm { @@ -1206,8 +1130,6 @@ class $itemsListPanelClassShort extends \\XLite\\View\\StickyPanel\\ItemsListFor /** * $targetHumanReadableName repository * - * @see ____class_see____ - * @since 1.0.0 */ class $entityRepoClassShort extends $entityRepoParentClass { @@ -1257,8 +1179,6 @@ class $entityRepoClassShort extends $entityRepoParentClass * @param boolean \$countOnly "Count only" flag. Do not need to add "order by" clauses if only count is needed. * * @return void - * @see ____func_see____ - * @since 1.0.0 */ protected function prepareCnd$fieldUpper(\Doctrine\ORM\QueryBuilder \$queryBuilder, \$value, \$countOnly) { @@ -1287,8 +1207,6 @@ protected function prepareCnd$fieldUpper(\Doctrine\ORM\QueryBuilder \$queryBuild * @param array \$value Condition data * * @return void - * @see ____func_see____ - * @since 1.0.0 */ protected function prepareCndLimit(\Doctrine\ORM\QueryBuilder \$queryBuilder, array \$value) { @@ -1316,8 +1234,6 @@ protected function prepareCndLimit(\Doctrine\ORM\QueryBuilder \$queryBuilder, ar * @param boolean \$countOnly "Count only" flag. Do not need to add "order by" clauses if only count is needed. * * @return void - * @see ____func_see____ - * @since 1.0.0 */ protected function prepareCndOrderBy(\Doctrine\ORM\QueryBuilder \$queryBuilder, \$value, \$countOnly) { @@ -1350,8 +1266,6 @@ protected function prepareCndOrderBy(\Doctrine\ORM\QueryBuilder \$queryBuilder, * @param boolean \$countOnly Return items list or only its size OPTIONAL * * @return \Doctrine\ORM\PersistentCollection|integer - * @see ____func_see____ - * @since 1.0.0 */ public function search(\XLite\Core\CommonCell \$cnd, \$countOnly = false) { @@ -1373,8 +1287,6 @@ public function search(\XLite\Core\CommonCell \$cnd, \$countOnly = false) * @param \Doctrine\ORM\QueryBuilder \$qb Query builder routine * * @return \Doctrine\ORM\PersistentCollection|integer - * @see ____func_see____ - * @since 1.0.0 */ public function searchCount(\Doctrine\ORM\QueryBuilder \$qb) { @@ -1389,8 +1301,6 @@ public function searchCount(\Doctrine\ORM\QueryBuilder \$qb) * @param \Doctrine\ORM\QueryBuilder \$qb Query builder routine * * @return \Doctrine\ORM\PersistentCollection|integer - * @see ____func_see____ - * @since 1.0.0 */ public function searchResult(\Doctrine\ORM\QueryBuilder \$qb) { @@ -1406,8 +1316,6 @@ public function searchResult(\Doctrine\ORM\QueryBuilder \$qb) * @param boolean \$countOnly Count only flag * * @return void - * @see ____func_see____ - * @since 1.0.0 */ protected function callSearchConditionHandler(\$value, \$key, \Doctrine\ORM\QueryBuilder \$queryBuilder, \$countOnly) { @@ -1422,8 +1330,6 @@ protected function callSearchConditionHandler(\$value, \$key, \Doctrine\ORM\Quer * @param string \$param Name of param to check * * @return boolean - * @see ____func_see____ - * @since 1.0.0 */ protected function isSearchParamHasHandler(\$param) { @@ -1434,8 +1340,6 @@ protected function isSearchParamHasHandler(\$param) * Return list of handling search params * * @return array - * @see ____func_see____ - * @since 1.0.0 */ protected function getHandlingSearchParams() { @@ -1473,8 +1377,6 @@ protected function getHandlingSearchParams() /** * $targetHumanReadableName menu item * - * @see ____class_see____ - * @since 1.0.0 * * @ListChild (list="$menuList", weight="last", zone="admin") */ @@ -1484,8 +1386,6 @@ class $menuShortClass extends \\XLite\\View\\TopMenu\\Node\\$menuParent\\A$menuP * Define widget parameters * * @return void - * @see ____func_see____ - * @since 1.0.0 */ protected function defineWidgetParams() { @@ -1522,17 +1422,13 @@ protected function defineWidgetParams() /** * $targetOneHumanReadableName controller * - * @see ____class_see____ - * @since 1.0.0 */ class $targetOneShort extends \\XLite\\Controller\\Admin\\AAdmin { /** * Controller parameters * - * @var array - * @see ____var_see____ - * @since 1.0.0 + * @var array */ protected \$params = array('target', 'id'); @@ -1540,8 +1436,6 @@ class $targetOneShort extends \\XLite\\Controller\\Admin\\AAdmin * Return the current page title (for the content area) * * @return string - * @see ____func_see____ - * @since 1.0.0 */ public function getTitle() { @@ -1559,8 +1453,6 @@ public function getTitle() * Update model * * @return void - * @see ____func_see____ - * @since 1.0.0 */ protected function doActionUpdate() { @@ -1573,8 +1465,6 @@ protected function doActionUpdate() * Get model form class * * @return string - * @see ____func_see____ - * @since 1.0.0 */ protected function getModelFormClass() { @@ -1603,8 +1493,6 @@ protected function getModelFormClass() /** * $targetOneHumanReadableName page view * - * @see ____class_see____ - * @since 1.0.0 * * @ListChild (list="admin.center", zone="admin") */ @@ -1614,8 +1502,6 @@ class $targetOneShort extends \\XLite\\View\\AView * Return list of allowed targets * * @return array - * @see ____func_see____ - * @since 1.0.0 */ public static function getAllowedTargets() { @@ -1626,8 +1512,6 @@ public static function getAllowedTargets() * Return widget default template * * @return string - * @see ____func_see____ - * @since 1.0.0 */ protected function getDefaultTemplate() { @@ -1655,10 +1539,9 @@ protected function getDefaultTemplate() * $targetOneHumanReadableName page template * * @author Creative Development LLC - * @copyright Copyright (c) 2011 Creative Development LLC . All rights reserved + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @link http://www.litecommerce.com/ - * @since 1.0.0 *} CODE; @@ -1684,17 +1567,13 @@ protected function getDefaultTemplate() /** * $targetOneHumanReadableName view model * - * @see ____class_see____ - * @since 1.0.0 */ class $oneViewModelClassShort extends \\XLite\\View\\Model\\AModel { /** * Shema default * - * @var array - * @see ____var_see____ - * @since 1.0.0 + * @var array */ protected \$schemaDefault = array( @@ -1733,8 +1612,6 @@ class $oneViewModelClassShort extends \\XLite\\View\\Model\\AModel * Return current model ID * * @return integer - * @see ____func_see____ - * @since 1.0.0 */ public function getModelId() { @@ -1745,8 +1622,6 @@ public function getModelId() * This object will be used if another one is not pased * * @return \\$entityClass - * @see ____func_see____ - * @since 1.0.0 */ protected function getDefaultModelObject() { @@ -1761,8 +1636,6 @@ protected function getDefaultModelObject() * Return name of web form widget class * * @return string - * @see ____func_see____ - * @since 1.0.0 */ protected function getFormClass() { @@ -1773,8 +1646,6 @@ protected function getFormClass() * Return list of the "Button" widgets * * @return array - * @see ____func_see____ - * @since 1.0.0 */ protected function getFormButtons() { @@ -1796,8 +1667,6 @@ protected function getFormButtons() * Add top message * * @return void - * @see ____func_see____ - * @since 1.0.0 */ protected function addDataSavedTopMessage() { @@ -1833,8 +1702,6 @@ protected function addDataSavedTopMessage() /** * $targetHumanReadableName list search form * - * @see ____class_see____ - * @since 1.0.0 */ class $formOneClassShort extends \\XLite\\View\\Form\\AForm { @@ -1842,8 +1709,6 @@ class $formOneClassShort extends \\XLite\\View\\Form\\AForm * Register CSS files * * @return array - * @see ____func_see____ - * @since 1.0.0 */ public function getCSSFiles() { @@ -1858,8 +1723,6 @@ public function getCSSFiles() * Return default value for the "target" parameter * * @return string - * @see ____func_see____ - * @since 1.0.0 */ protected function getDefaultTarget() { @@ -1870,8 +1733,6 @@ protected function getDefaultTarget() * Return default value for the "action" parameter * * @return string - * @see ____func_see____ - * @since 1.0.0 */ protected function getDefaultAction() { @@ -1882,8 +1743,6 @@ protected function getDefaultAction() * Get default class name * * @return string - * @see ____func_see____ - * @since 1.0.0 */ protected function getDefaultClassName() { @@ -1894,8 +1753,6 @@ protected function getDefaultClassName() * Return list of the form default parameters * * @return array - * @see ____func_see____ - * @since 1.0.0 */ protected function getDefaultParams() { @@ -1924,10 +1781,9 @@ protected function getDefaultParams() * $targetOneHumanReadableName view model styles * * @author Creative Development LLC - * @copyright Copyright (c) 2011 Creative Development LLC . All rights reserved + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @link http://www.litecommerce.com/ - * @since 1.0.0 */ CODE; diff --git a/.gitignore b/.gitignore index b59f4be725..d5240d5d9d 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ /src/var/.modules.structures.registry.php /src/var/.modules.structures.registry.hash.php /nbproject +*.swp diff --git a/src/classes/XLite/Controller/Admin/Attribute.php b/src/classes/XLite/Controller/Admin/Attribute.php new file mode 100644 index 0000000000..1b52cced9c --- /dev/null +++ b/src/classes/XLite/Controller/Admin/Attribute.php @@ -0,0 +1,162 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\Controller\Admin; + +/** + * Attribute controller + * + */ +class Attribute extends \XLite\Controller\Admin\AAdmin +{ + /** + * Controller parameters + * + * @var array + */ + protected $params = array('target', 'id', 'product_class_id'); + + /** + * Product class + * + * @var \XLite\Model\ProductClass + */ + protected $productClass; + + /** + * Attribute + * + * @var \XLite\Model\Attribute + */ + protected $attribute; + + /** + * Check ACL permissions + * + * @return boolean + */ + public function checkACL() + { + return (parent::checkACL() || \XLite\Core\Auth::getInstance()->isPermissionAllowed('manage catalog')) + && $this->getProductClass() + && $this->isAJAX(); + } + + /** + * Get product class + * + * @return \XLite\Model\ProductClass + */ + public function getProductClass() + { + if ( + is_null($this->productClass) + && \XLite\Core\Request::getInstance()->product_class_id + ) { + $this->productClass = \XLite\Core\Database::getRepo('XLite\Model\ProductClass') + ->find(intval(\XLite\Core\Request::getInstance()->product_class_id)); + } + + return $this->productClass; + } + + /** + * Get attribute + * + * @return \XLite\Model\Attribute + */ + public function getAttribute() + { + if ( + is_null($this->attribute) + && \XLite\Core\Request::getInstance()->id + ) { + $this->attribute = \XLite\Core\Database::getRepo('XLite\Model\Attribute') + ->find(intval(\XLite\Core\Request::getInstance()->id)); + } + + return $this->attribute; + } + + /** + * Return the current page title (for the content area) + * + * @return string + */ + public function getTitle() + { + $id = intval(\XLite\Core\Request::getInstance()->id); + $model = $id + ? \XLite\Core\Database::getRepo('XLite\Model\Attribute')->find($id) + : null; + + return ($model && $model->getId()) + ? \XLite\Core\Translation::getInstance()->lbl('Edit attribute values') + : \XLite\Core\Translation::getInstance()->lbl('New attribute'); + } + + /** + * Update model + * + * @return void + */ + protected function doActionUpdate() + { + if ($this->getModelForm()->getModelObject()->getId()) { + $this->setSilenceClose(); + + } else { + $this->setInternalRedirect(); + } + + $list = new \XLite\View\ItemsList\Model\AttributeOption; + $list->processQuick(); + + if ($this->getModelForm()->performAction('modify')) { + $this->setReturnUrl( + \XLite\Core\Converter::buildURL( + 'attribute', + '', + array( + 'id' => $this->getModelForm()->getModelObject()->getId(), + 'product_class_id' => \XLite\Core\Request::getInstance()->product_class_id, + 'widget' => 'XLite\View\Attribute' + ) + ) + ); + } + } + + /** + * Get model form class + * + * @return string + */ + protected function getModelFormClass() + { + return 'XLite\View\Model\Attribute'; + } + +} diff --git a/src/classes/XLite/Controller/Admin/AttributeGroup.php b/src/classes/XLite/Controller/Admin/AttributeGroup.php new file mode 100644 index 0000000000..b9670b85b3 --- /dev/null +++ b/src/classes/XLite/Controller/Admin/AttributeGroup.php @@ -0,0 +1,116 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\Controller\Admin; + +/** + * Attribute group controller + * + */ +class AttributeGroup extends \XLite\Controller\Admin\AAdmin +{ + /** + * Controller parameters + * + * @var array + */ + protected $params = array('target', 'id', 'product_class_id'); + + /** + * Product class + * + * @var \XLite\Model\ProductClass + */ + protected $productClass; + + /** + * Check ACL permissions + * + * @return boolean + */ + public function checkACL() + { + return (parent::checkACL() || \XLite\Core\Auth::getInstance()->isPermissionAllowed('manage catalog')) + && $this->getProductClass(); + } + + /** + * Get product class + * + * @return \XLite\Model\ProductClass + */ + public function getProductClass() + { + if ( + is_null($this->productClass) + && \XLite\Core\Request::getInstance()->product_class_id + ) { + $this->productClass = \XLite\Core\Database::getRepo('XLite\Model\ProductClass') + ->find(intval(\XLite\Core\Request::getInstance()->product_class_id)); + } + + return $this->productClass; + } + + /** + * Return the current page title (for the content area) + * + * @return string + */ + public function getTitle() + { + $id = intval(\XLite\Core\Request::getInstance()->id); + $model = $id + ? \XLite\Core\Database::getRepo('XLite\Model\AttributeGroup')->find($id) + : null; + + return ($model && $model->getId()) + ? $model->getName() + : \XLite\Core\Translation::getInstance()->lbl('AttributeGroup'); + } + + /** + * Update model + * + * @return void + */ + protected function doActionUpdate() + { + if ($this->getModelForm()->performAction('modify')) { + $this->setReturnUrl(\XLite\Core\Converter::buildURL('attribute_groups')); + } + } + + /** + * Get model form class + * + * @return string + */ + protected function getModelFormClass() + { + return 'XLite\View\Model\AttributeGroup'; + } + +} diff --git a/src/classes/XLite/Controller/Admin/AttributeGroups.php b/src/classes/XLite/Controller/Admin/AttributeGroups.php new file mode 100644 index 0000000000..989f32e9b4 --- /dev/null +++ b/src/classes/XLite/Controller/Admin/AttributeGroups.php @@ -0,0 +1,170 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\Controller\Admin; + +/** + * Attribute groups controller + * + */ +class AttributeGroups extends \XLite\Controller\Admin\AAdmin +{ + /** + * Controller parameters + * + * @var array + */ + protected $params = array('target', 'product_class_id'); + + /** + * Product class + * + * @var \XLite\Model\ProductClass + */ + protected $productClass; + + /** + * Check ACL permissions + * + * @return boolean + */ + public function checkACL() + { + return (parent::checkACL() || \XLite\Core\Auth::getInstance()->isPermissionAllowed('manage catalog')) + && $this->getProductClass() + && $this->isAJAX(); + } + + /** + * Get product class + * + * @return \XLite\Model\ProductClass + */ + public function getProductClass() + { + if ( + is_null($this->productClass) + && \XLite\Core\Request::getInstance()->product_class_id + ) { + $this->productClass = \XLite\Core\Database::getRepo('XLite\Model\ProductClass') + ->find(intval(\XLite\Core\Request::getInstance()->product_class_id)); + } + + return $this->productClass; + } + + /** + * Update list + * + * @return void + */ + protected function doActionUpdate() + { + $this->setSilenceClose(); + $list = new \XLite\View\ItemsList\Model\AttributeGroup; + $list->processQuick(); + } + + /** + * Return the current page title (for the content area) + * + * @return string + */ + public function getTitle() + { + return static::t('Manage attribute groups'); + } + + // {{{ Search + + /** + * Get search condition parameter by name + * + * @param string $paramName Parameter name + * + * @return mixed + */ + public function getCondition($paramName) + { + $searchParams = $this->getConditions(); + + return isset($searchParams[$paramName]) + ? $searchParams[$paramName] + : null; + } + + /** + * Save search conditions + * + * @return void + */ + protected function doActionSearch() + { + $cellName = \XLite\View\ItemsList\Model\AttributeGroup::getSessionCellName(); + + \XLite\Core\Session::getInstance()->$cellName = $this->getSearchParams(); + } + + /** + * Return search parameters + * + * @return array + */ + protected function getSearchParams() + { + $searchParams = $this->getConditions(); + + foreach ( + \XLite\View\ItemsList\Model\AttributeGroup::getSearchParams() as $requestParam + ) { + if (isset(\XLite\Core\Request::getInstance()->$requestParam)) { + $searchParams[$requestParam] = \XLite\Core\Request::getInstance()->$requestParam; + } + } + + return $searchParams; + } + + /** + * Get search conditions + * + * @return array + */ + protected function getConditions() + { + $cellName = \XLite\View\ItemsList\Model\AttributeGroup::getSessionCellName(); + + $searchParams = \XLite\Core\Session::getInstance()->$cellName; + + if (!is_array($searchParams)) { + $searchParams = array(); + } + + return $searchParams; + } + + // }}} + +} diff --git a/src/classes/XLite/Controller/Admin/AttributeOption.php b/src/classes/XLite/Controller/Admin/AttributeOption.php new file mode 100644 index 0000000000..778f80f9f7 --- /dev/null +++ b/src/classes/XLite/Controller/Admin/AttributeOption.php @@ -0,0 +1,80 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\Controller\Admin; + +/** + * Attribute option controller + * + */ +class AttributeOption extends \XLite\Controller\Admin\AAdmin +{ + /** + * Controller parameters + * + * @var array + */ + protected $params = array('target', 'id'); + + /** + * Return the current page title (for the content area) + * + * @return string + */ + public function getTitle() + { + $id = intval(\XLite\Core\Request::getInstance()->id); + $model = $id + ? \XLite\Core\Database::getRepo('XLite\Model\AttributeOption')->find($id) + : null; + + return ($model && $model->getId()) + ? $model->getName() + : \XLite\Core\Translation::getInstance()->lbl('AttributeOption'); + } + + /** + * Update model + * + * @return void + */ + protected function doActionUpdate() + { + if ($this->getModelForm()->performAction('modify')) { + $this->setReturnUrl(\XLite\Core\Converter::buildURL('attribute_options')); + } + } + + /** + * Get model form class + * + * @return string + */ + protected function getModelFormClass() + { + return 'XLite\View\Model\AttributeOption'; + } + +} \ No newline at end of file diff --git a/src/classes/XLite/Controller/Admin/AttributeOptions.php b/src/classes/XLite/Controller/Admin/AttributeOptions.php new file mode 100644 index 0000000000..5dd8d4d0a7 --- /dev/null +++ b/src/classes/XLite/Controller/Admin/AttributeOptions.php @@ -0,0 +1,105 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\Controller\Admin; + +/** + * Attribute options controller + * + */ +class AttributeOptions extends \XLite\Controller\Admin\AAdmin +{ + + // {{{ Search + + /** + * Get search condition parameter by name + * + * @param string $paramName Parameter name + * + * @return mixed + */ + public function getCondition($paramName) + { + $searchParams = $this->getConditions(); + + return isset($searchParams[$paramName]) + ? $searchParams[$paramName] + : null; + } + + /** + * Save search conditions + * + * @return void + */ + protected function doActionSearch() + { + $cellName = \XLite\View\ItemsList\Model\AttributeOption::getSessionCellName(); + + \XLite\Core\Session::getInstance()->$cellName = $this->getSearchParams(); + } + + /** + * Return search parameters + * + * @return array + */ + protected function getSearchParams() + { + $searchParams = $this->getConditions(); + + foreach ( + \XLite\View\ItemsList\Model\AttributeOption::getSearchParams() as $requestParam + ) { + if (isset(\XLite\Core\Request::getInstance()->$requestParam)) { + $searchParams[$requestParam] = \XLite\Core\Request::getInstance()->$requestParam; + } + } + + return $searchParams; + } + + /** + * Get search conditions + * + * @return array + */ + protected function getConditions() + { + $cellName = \XLite\View\ItemsList\Model\AttributeOption::getSessionCellName(); + + $searchParams = \XLite\Core\Session::getInstance()->$cellName; + + if (!is_array($searchParams)) { + $searchParams = array(); + } + + return $searchParams; + } + + // }}} + +} \ No newline at end of file diff --git a/src/classes/XLite/Controller/Admin/Attributes.php b/src/classes/XLite/Controller/Admin/Attributes.php new file mode 100644 index 0000000000..82f6da3c86 --- /dev/null +++ b/src/classes/XLite/Controller/Admin/Attributes.php @@ -0,0 +1,185 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\Controller\Admin; + +/** + * Attributes controller + * + */ +class Attributes extends \XLite\Controller\Admin\AAdmin +{ + /** + * Controller parameters + * + * @var array + */ + protected $params = array('target', 'product_class_id'); + + /** + * Product class + * + * @var \XLite\Model\ProductClass + */ + protected $productClass; + + /** + * Check ACL permissions + * + * @return boolean + */ + public function checkACL() + { + return (parent::checkACL() || \XLite\Core\Auth::getInstance()->isPermissionAllowed('manage catalog')) + && $this->getProductClass(); + } + + /** + * Get product class + * + * @return \XLite\Model\ProductClass + */ + public function getProductClass() + { + if ( + is_null($this->productClass) + && \XLite\Core\Request::getInstance()->product_class_id + ) { + $this->productClass = \XLite\Core\Database::getRepo('XLite\Model\ProductClass') + ->find(intval(\XLite\Core\Request::getInstance()->product_class_id)); + } + + return $this->productClass; + } + + /** + * Get product class + * + * @return \Doctrine\ORM\PersistentCollection + */ + public function getAttributeGroups() + { + return $this->getProductClass()->getAttributeGroups(); + } + + /** + * Update list + * + * @return void + */ + protected function doActionUpdate() + { + $list = new \XLite\View\ItemsList\Model\Attribute; + $list->processQuick(); + } + + /** + * Return the current page title (for the content area) + * + * @return string + */ + public function getTitle() + { + return $this->getProductClass() + ? \XLite\Core\Translation::getInstance()->lbl( + 'Attributes for "{{class}}" product class', + array( + 'class' => $this->getProductClass()->getName() + ) + ) + : null; + } + + // {{{ Search + + /** + * Get search condition parameter by name + * + * @param string $paramName Parameter name + * + * @return mixed + */ + public function getCondition($paramName) + { + $searchParams = $this->getConditions(); + + return isset($searchParams[$paramName]) + ? $searchParams[$paramName] + : null; + } + + /** + * Save search conditions + * + * @return void + */ + protected function doActionSearch() + { + $cellName = \XLite\View\ItemsList\Model\Attribute::getSessionCellName(); + + \XLite\Core\Session::getInstance()->$cellName = $this->getSearchParams(); + } + + /** + * Return search parameters + * + * @return array + */ + protected function getSearchParams() + { + $searchParams = $this->getConditions(); + + foreach ( + \XLite\View\ItemsList\Model\Attribute::getSearchParams() as $requestParam + ) { + if (isset(\XLite\Core\Request::getInstance()->$requestParam)) { + $searchParams[$requestParam] = \XLite\Core\Request::getInstance()->$requestParam; + } + } + + return $searchParams; + } + + /** + * Get search conditions + * + * @return array + */ + protected function getConditions() + { + $cellName = \XLite\View\ItemsList\Model\Attribute::getSessionCellName(); + + $searchParams = \XLite\Core\Session::getInstance()->$cellName; + + if (!is_array($searchParams)) { + $searchParams = array(); + } + + return $searchParams; + } + + // }}} + +} diff --git a/src/classes/XLite/Controller/Admin/Autocomplete.php b/src/classes/XLite/Controller/Admin/Autocomplete.php index b1b0d9cb88..f15b1cdb02 100644 --- a/src/classes/XLite/Controller/Admin/Autocomplete.php +++ b/src/classes/XLite/Controller/Admin/Autocomplete.php @@ -51,7 +51,7 @@ protected function doNoAction() $method = 'assembleDictionary' . \XLite\Core\Converter::convertToCamelCase($dictionary); if (method_exists($this, $method)) { $this->data = $this->processData( - $this->$method(strval(\XLite\Core\Request::getInstance()->erm)) + $this->$method(strval(\XLite\Core\Request::getInstance()->term)) ); } } @@ -95,4 +95,34 @@ public function processRequest() print ($content); } + + + /** + * Assemble dictionary - conversation recipient + * + * @param string $term Term + * + * @return array + */ + protected function assembleDictionaryAttributeOption($term) + { + $cnd = new \XLite\Core\CommonCell; + if ($term) { + $cnd->{\XLite\Model\Repo\AttributeOption::SEARCH_NAME} = $term; + } + + $id = intval(\XLite\Core\Request::getInstance()->id); + if ($id) { + $cnd->{\XLite\Model\Repo\AttributeOption::SEARCH_ATTRIBUTE} = $id; + } + + $list = array(); + + foreach (\XLite\Core\Database::getRepo('\XLite\Model\AttributeOption')->search($cnd) as $a) { + $list[$a->getName()] = $a->getName(); + } + + return $list; + } + } diff --git a/src/classes/XLite/Controller/Admin/Product.php b/src/classes/XLite/Controller/Admin/Product.php index 1789eb07dd..cfe7a1d316 100644 --- a/src/classes/XLite/Controller/Admin/Product.php +++ b/src/classes/XLite/Controller/Admin/Product.php @@ -99,6 +99,9 @@ public function getPages() if (!$this->isNew()) { $list['images'] = 'Product images'; $list['inventory'] = 'Inventory tracking'; + if ($this->getProduct()->getClasses()->count()) { + $list['attributes'] = 'Attributes'; + } } return $list; @@ -118,6 +121,9 @@ protected function getPageTemplates() if (!$this->isNew()) { $list['images'] = 'product/product_images.tpl'; $list['inventory'] = 'product/inventory.tpl'; + if ($this->getProduct()->getClasses()->count()) { + $list['attributes'] = 'product/attributes.tpl'; + } } return $list; @@ -446,5 +452,34 @@ protected function doActionUpdateInventory() \XLite\Core\Database::getEM()->flush(); } + /** + * Update attributes + * + * @return void + */ + protected function doActionUpdateAttributes() + { + $this->getProduct()->setAttrSepTab((bool) \XLite\Core\Request::getInstance()->attrSepTab); + $cnd = new \XLite\Core\CommonCell; + $cnd->product = $this->getProduct(); + $attributes = \XLite\Core\Database::getRepo('\XLite\Model\Attribute')->search($cnd); + $attributeValues = \XLite\Core\Request::getInstance()->attributeValues; + + if ( + count($attributes) + && $attributeValues + && is_array($attributeValues) + ) { + foreach ($attributes as $a) { + if (isset($attributeValues[$a->getId()])) { + $a->setAttributeValue($this->getProduct(), $attributeValues[$a->getId()]); + } + } + } + + \XLite\Core\Database::getEM()->flush(); + \XLite\Core\TopMessage::addInfo('Attributes have been updated successfully'); + } + // }}} } diff --git a/src/classes/XLite/Controller/Admin/ProductClass.php b/src/classes/XLite/Controller/Admin/ProductClass.php index f30c41134f..cc3430ed94 100644 --- a/src/classes/XLite/Controller/Admin/ProductClass.php +++ b/src/classes/XLite/Controller/Admin/ProductClass.php @@ -32,22 +32,11 @@ class ProductClass extends \XLite\Controller\Admin\AAdmin { /** - * Constants - */ - const STATUS_ERROR = 'error'; - const STATUS_INAPPLY = 'inapply'; - const STATUS_SUCCESS = 'success'; - const STATUS_FAILED = 'failed'; - - /** - * data + * Controller parameters * * @var array */ - protected $data = array( - 'status' => self::STATUS_ERROR, - 'data' => '', - ); + protected $params = array('target', 'id'); /** * Check ACL permissions @@ -60,71 +49,42 @@ public function checkACL() } /** - * Remove product class + * Return the current page title (for the content area) * - * @return void + * @return string */ - protected function doActionRemove() + public function getTitle() { - if (isset(\XLite\Core\Request::getInstance()->id)) { - \XLite\Core\Database::getRepo('\XLite\Model\ProductClass')->deleteById( - \XLite\Core\Request::getInstance()->id - ); - } - - $this->setReturnURL($this->buildURL('product_classes')); + $id = intval(\XLite\Core\Request::getInstance()->id); + $model = $id + ? \XLite\Core\Database::getRepo('XLite\Model\ProductClass')->find($id) + : null; + + return ($model && $model->getId()) + ? $model->getName() + : \XLite\Core\Translation::getInstance()->lbl('ProductClass'); } /** - * AJAX product class update + * Update model * * @return void */ protected function doActionUpdate() { - $data = array( - 'name' => \XLite\Core\Request::getInstance()->name, - ); - - \XLite\Core\Database::getRepo('\XLite\Model\ProductClass')->updateById( - \XLite\Core\Request::getInstance()->id, - $data - ); + if ($this->getModelForm()->performAction('modify')) { + $this->setReturnUrl(\XLite\Core\Converter::buildURL('product_classes')); + } } /** - * AJAX product class adding - * - * @return void + * Get model form class + * + * @return string */ - protected function doActionAdd() + protected function getModelFormClass() { - $data = new \XLite\Model\ProductClass(); - $data->setName(\XLite\Core\Request::getInstance()->name); - - $data = \XLite\Core\Database::getRepo('\XLite\Model\ProductClass')->insert($data); - - $this->data['data'] = array( - 'id' => $data->getId(), - 'name' => $data->getName(), - ); - - $this->data['status'] = static::STATUS_SUCCESS; + return 'XLite\View\Model\ProductClass'; } - /** - * Send JSON data after "ADD" action - * - * @return void - */ - protected function actionPostprocessAdd() - { - header('Content-type: application/json'); - $data = json_encode($this->data); - header('Content-Length: ' . strlen($data)); - - echo ($data); - - exit (0); - } } diff --git a/src/classes/XLite/Controller/Admin/ProductClasses.php b/src/classes/XLite/Controller/Admin/ProductClasses.php index 8757fc66c5..fb6360c33d 100644 --- a/src/classes/XLite/Controller/Admin/ProductClasses.php +++ b/src/classes/XLite/Controller/Admin/ProductClasses.php @@ -26,63 +26,111 @@ namespace XLite\Controller\Admin; /** - * Product classes + * Product classes controller * */ class ProductClasses extends \XLite\Controller\Admin\AAdmin { + /** - * Field name for new 'name' value + * Check ACL permissions + * + * @return boolean */ - const NEW_NAME = 'new_name'; + public function checkACL() + { + return parent::checkACL() || \XLite\Core\Auth::getInstance()->isPermissionAllowed('manage catalog'); + } /** - * Field name for 'name' array values + * Return the current page title (for the content area) + * + * @return string */ - const NAME = 'name'; + public function getTitle() + { + return static::t('Product classes'); + } + /** + * Update list + * + * @return void + */ + protected function doActionUpdate() + { + $list = new \XLite\View\ItemsList\Model\ProductClass; + $list->processQuick(); + } + + // {{{ Search /** - * Check ACL permissions + * Get search condition parameter by name * - * @return boolean + * @param string $paramName Parameter name + * + * @return mixed */ - public function checkACL() + public function getCondition($paramName) { - return parent::checkACL() || \XLite\Core\Auth::getInstance()->isPermissionAllowed('manage catalog'); + $searchParams = $this->getConditions(); + + return isset($searchParams[$paramName]) + ? $searchParams[$paramName] + : null; } /** - * Update action + * Save search conditions * * @return void */ - protected function doActionUpdate() + protected function doActionSearch() { - $data = $this->getPostedData(); + $cellName = \XLite\View\ItemsList\Model\ProductClass::getSessionCellName(); - if (!empty($data[static::NEW_NAME])) { - $this->addClass($data[static::NEW_NAME]); - } + \XLite\Core\Session::getInstance()->$cellName = $this->getSearchParams(); + } - if (isset($data[static::NEW_NAME])) { - unset($data[static::NEW_NAME]); - } + /** + * Return search parameters + * + * @return array + */ + protected function getSearchParams() + { + $searchParams = $this->getConditions(); - if (!empty($data)) { - \XLite\Core\Database::getRepo('\XLite\Model\ProductClass')->updateInBatchById($data); + foreach ( + \XLite\View\ItemsList\Model\ProductClass::getSearchParams() as $requestParam + ) { + if (isset(\XLite\Core\Request::getInstance()->$requestParam)) { + $searchParams[$requestParam] = \XLite\Core\Request::getInstance()->$requestParam; + } } + + return $searchParams; } /** - * Add product class entry - * - * @param string $name Name value + * Get search conditions * - * @return void + * @return array */ - protected function addClass($name) + protected function getConditions() { - \XLite\Core\Database::getRepo('\XLite\Model\ProductClass')->insert(array(static::NAME => strval($name))); + $cellName = \XLite\View\ItemsList\Model\ProductClass::getSessionCellName(); + + $searchParams = \XLite\Core\Session::getInstance()->$cellName; + + if (!is_array($searchParams)) { + $searchParams = array(); + } + + return $searchParams; } + + // }}} + } diff --git a/src/classes/XLite/Model/Attribute.php b/src/classes/XLite/Model/Attribute.php new file mode 100644 index 0000000000..3040c936f8 --- /dev/null +++ b/src/classes/XLite/Model/Attribute.php @@ -0,0 +1,372 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\Model; + +/** + * Attribute + * + * @Entity + * @Table (name="attributes") + */ +class Attribute extends \XLite\Model\Base\I18n +{ + /* + * Attribute types + */ + const TYPE_NUMBER = 'N'; + const TYPE_TEXT = 'T'; + const TYPE_CHECKBOX = 'C'; + const TYPE_SELECT = 'S'; + + /** + * ID + * + * @var integer + * + * @Id + * @GeneratedValue (strategy="AUTO") + * @Column (type="uinteger") + */ + protected $id; + + /** + * Position + * + * @var integer + * @see ____var_see____ + * @since 1.0.0 + * + * @Column (type="integer") + */ + protected $position = 0; + + /** + * Default value + * + * @var text + * @see ____var_see____ + * @since 1.0.0 + * + * @Column (type="text") + */ + protected $defaultValue = ''; + + /** + * Decimals + * + * @var integer + * @see ____var_see____ + * @since 1.0.0 + * + * @Column (type="integer", length=1) + */ + protected $decimals = 0; + + /** + * Product class + * + * @var \XLite\Model\ProductClass + * + * @ManyToOne (targetEntity="XLite\Model\ProductClass", inversedBy="attributes") + * @JoinColumn (name="product_class_id", referencedColumnName="id") + */ + protected $product_class; + + /** + * Attribute group + * + * @var selfGroup + * + * @ManyToOne (targetEntity="XLite\Model\AttributeGroup", inversedBy="attributes") + * @JoinColumn (name="attribute_group_id", referencedColumnName="id", onDelete="SET NULL") + */ + protected $attribute_group; + + /** + * Attribute options + * + * @var \Doctrine\Common\Collections\Collection + * + * @OneToMany (targetEntity="XLite\Model\AttributeOption", mappedBy="attribute") + */ + protected $attribute_options; + + /** + * Option type + * + * @var string + * + * @Column (type="fixedstring", length=1) + */ + protected $type = self::TYPE_NUMBER; + + /** + * Constructor + * + * @param array $data Entity properties OPTIONAL + * + * @return void + */ + public function __construct(array $data = array()) + { + $this->attribute_options = new \Doctrine\Common\Collections\ArrayCollection(); + + parent::__construct($data); + } + + /** + * Return number of products associated with this attribute + * + * @return integer + */ + public function getProductsCount() + { + return count($this->getClass()->getProducts()); + } + + /** + * Return list of types or type + * + * @param string $type Type OPTIONAL + * + * @return array | string + */ + public static function getTypes($type = null) + { + $list = array( + self::TYPE_NUMBER => 'Number', + self::TYPE_TEXT => 'Text', + self::TYPE_CHECKBOX => 'Checkbox', + self::TYPE_SELECT => 'Select', + ); + + return isset($type) + ? (isset($list[$type]) ? $list[$type] : null) + : $list; + } + + /** + * Return number of values associated with this attribute + * + * @return integer + */ + public function getAttributeValuesCount() + { + $cnd = new \XLite\Core\CommonCell; + $cnd->attribute = $this; + + return \XLite\Core\Database::getRepo($this->getAttributeValueClass()) + ->search($cnd, true); + } + + /** + * Set type + * + * @param string $type Type + * + * @return void + */ + public function setType($type) + { + $types = static::getTypes(); + + if (isset($types[$type])) { + if ( + $this->type + && $type != $this->type + ) { + $this->setDefaultValue($this->defaultValue); + foreach ($this->getAttributeOptions() as $option) { + \XLite\Core\Database::getEM()->remove($option); + } + } + $this->type = $type; + } + } + + /** + * Set default type + * + * @param string $value Value + * + * @return void + */ + public function setDefaultValue($value) + { + if (self::TYPE_NUMBER == $this->type) { + $value = (float)$value; + + } elseif (self::TYPE_CHECKBOX == $this->type) { + $value = (boolean)$value; + + } + + $this->defaultValue = $value; + } + + /** + * Get default value + * + * @return mixed + */ + public function getDefaultValue() + { + return self::TYPE_CHECKBOX == $this->type + ? (boolean)$this->defaultValue + : $this->defaultValue; + } + + /** + * Return name of widget class + * + * @return string + */ + public function getWidgetClass() + { + switch ($this->getType()) { + case self::TYPE_NUMBER: + $class = '\XLite\View\FormField\Input\Text\Float'; + break; + + case self::TYPE_TEXT: + $class = '\XLite\View\FormField\Textarea\Simple'; + break; + + case self::TYPE_CHECKBOX: + $class = '\XLite\View\FormField\Input\Checkbox\Enabled'; + break; + + case self::TYPE_SELECT: + $class = '\XLite\View\FormField\Input\Text\AttributeOption'; + break; + + } + + return $class; + } + + /** + * Return name of value class + * + * @return string + */ + public function getAttributeValueClass() + { + return '\XLite\Model\AttributeValue\AttributeValue' + . $this->getTypes($this->getType()); + } + + /** + * Set attribute value + * + * @param \XLite\Model\Product $product Product + * @param mixed $value Value + * + * @return void + */ + public function setAttributeValue(\XLite\Model\Product $product, $value) + { + $class = $this->getAttributeValueClass(); + $attributeValue = \XLite\Core\Database::getRepo($class) + ->findOneBy(array('product' => $product, 'attribute' => $this)); + + if (!$attributeValue) { + !$attributeValue = new $class(); + $attributeValue->setProduct($product); + $attributeValue->setAttribute($this); + \XLite\Core\Database::getEM()->persist($attributeValue); + } + + if (self::TYPE_SELECT == $this->getType()) { + if ($value) { + $attributeOption = \XLite\Core\Database::getRepo('XLite\Model\AttributeOption') + ->findOneByNameAndAttribute($value, $this); + + if (!$attributeOption) { + $attributeOption = new \XLite\Model\AttributeOption(); + $attributeOption->setAttribute($this); + $attributeOption->setName($value); + \XLite\Core\Database::getEM()->persist($attributeOption); + } + $attributeValue->setAttributeOption($attributeOption); + } + + } else { + $attributeValue->setValue($value); + } + } + + /** + * Get attribute value + * + * @param \XLite\Model\Product $product Product + * @param bollean $asString As string flag OPTIONAL + * + * @return mixed + */ + public function getAttributeValue(\XLite\Model\Product $product, $asString = false) + { + $attributeValue = \XLite\Core\Database::getRepo($this->getAttributeValueClass()) + ->findOneBy(array('product' => $product, 'attribute' => $this)); + + if (self::TYPE_SELECT == $this->getType()) { + if ($attributeValue) { + $attributeValue = $attributeValue->getAttributeOption(); + } else { + $attributeValue = \XLite\Core\Database::getRepo('XLite\Model\AttributeOption') + ->findOneBy(array('defaultValue' => 1, 'attribute' => $this)); + } + + if ( + $attributeValue + && $asString + ) { + $attributeValue = $attributeValue->getName(); + } + + } elseif ($attributeValue) { + $attributeValue = $attributeValue->getValue(); + } + + if (is_null($attributeValue)) { + $attributeValue = self::TYPE_SELECT == $this->getType() + ? '' + : $this->getDefaultValue(); + } + + if ($asString) { + if(self::TYPE_NUMBER == $this->getType()) { + $attributeValue = number_format($attributeValue, $this->getDecimals()) + . ' ' . $this->getUnit(); + + } elseif (self::TYPE_CHECKBOX == $this->getType()) { + $attributeValue = static::t($attributeValue ? 'yes' : 'no'); + } + } + + return $attributeValue; + } +} diff --git a/src/classes/XLite/Model/AttributeGroup.php b/src/classes/XLite/Model/AttributeGroup.php new file mode 100644 index 0000000000..f21f746cd4 --- /dev/null +++ b/src/classes/XLite/Model/AttributeGroup.php @@ -0,0 +1,100 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\Model; + +/** + * Attribute group + * + * @Entity + * @Table (name="attribute_groups") + */ +class AttributeGroup extends \XLite\Model\Base\I18n +{ + /** + * ID + * + * @var integer + * + * @Id + * @GeneratedValue (strategy="AUTO") + * @Column (type="uinteger") + */ + protected $id; + + /** + * Position + * + * @var integer + * @see ____var_see____ + * @since 1.0.0 + * + * @Column (type="integer") + */ + protected $position = 0; + + /** + * Product class + * + * @var \XLite\Model\ProductClass + * + * @ManyToOne (targetEntity="XLite\Model\ProductClass", inversedBy="attribute_groups") + * @JoinColumn (name="product_class_id", referencedColumnName="id") + */ + protected $product_class; + + /** + * Attributes + * + * @var \Doctrine\Common\Collections\Collection + * + * @OneToMany (targetEntity="XLite\Model\Attribute", mappedBy="attribute_group") + */ + protected $attributes; + + /** + * Constructor + * + * @param array $data Entity properties OPTIONAL + * + * @return void + */ + public function __construct(array $data = array()) + { + $this->attributes = new \Doctrine\Common\Collections\ArrayCollection(); + + parent::__construct($data); + } + + /** + * Return number of attributes associated with this class + * + * @return integer + */ + public function getAttributesCount() + { + return count($this->getAttributes()); + } +} diff --git a/src/classes/XLite/Model/AttributeGroupTranslation.php b/src/classes/XLite/Model/AttributeGroupTranslation.php new file mode 100644 index 0000000000..9c13cf7d30 --- /dev/null +++ b/src/classes/XLite/Model/AttributeGroupTranslation.php @@ -0,0 +1,51 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\Model; + +/** + * Attribute group multilingual data + * + * + * @Entity + * + * @Table (name="attribute_group_translations", + * indexes={ + * @Index (name="ci", columns={"code","id"}), + * @Index (name="id", columns={"id"}) + * } + * ) + */ +class AttributeGroupTranslation extends \XLite\Model\Base\Translation +{ + /** + * Name + * + * @var string + * + * @Column (type="string", length=255) + */ + protected $name; +} diff --git a/src/classes/XLite/Model/AttributeOption.php b/src/classes/XLite/Model/AttributeOption.php new file mode 100644 index 0000000000..52ce7a6ae4 --- /dev/null +++ b/src/classes/XLite/Model/AttributeOption.php @@ -0,0 +1,67 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\Model; + +/** + * Attribute option + * + * @Entity + * @Table (name="attribute_options") + */ +class AttributeOption extends \XLite\Model\Base\I18n +{ + /** + * ID + * + * @var integer + * + * @Id + * @GeneratedValue (strategy="AUTO") + * @Column (type="uinteger") + */ + protected $id; + + /** + * Default flag + * + * @var boolean + * @see ____var_see____ + * @since 1.0.0 + * + * @Column (type="boolean") + */ + protected $defaultValue = false; + + /** + * Attribute + * + * @var \XLite\Model\Attribute + * + * @ManyToOne (targetEntity="XLite\Model\Attribute", inversedBy="attribute_options") + * @JoinColumn (name="attribute_id", referencedColumnName="id") + */ + protected $attribute; +} diff --git a/src/classes/XLite/Model/AttributeOptionTranslation.php b/src/classes/XLite/Model/AttributeOptionTranslation.php new file mode 100644 index 0000000000..a0a2d9bbef --- /dev/null +++ b/src/classes/XLite/Model/AttributeOptionTranslation.php @@ -0,0 +1,51 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\Model; + +/** + * Attribute option multilingual data + * + * + * @Entity + * + * @Table (name="attribute_option_translations", + * indexes={ + * @Index (name="ci", columns={"code","id"}), + * @Index (name="id", columns={"id"}) + * } + * ) + */ +class AttributeOptionTranslation extends \XLite\Model\Base\Translation +{ + /** + * Name + * + * @var string + * + * @Column (type="string", length=255) + */ + protected $name; +} diff --git a/src/classes/XLite/Model/AttributeTranslation.php b/src/classes/XLite/Model/AttributeTranslation.php new file mode 100644 index 0000000000..14566904e1 --- /dev/null +++ b/src/classes/XLite/Model/AttributeTranslation.php @@ -0,0 +1,63 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\Model; + +/** + * Attribute multilingual data + * + * + * @Entity + * + * @Table (name="attribute_translations", + * indexes={ + * @Index (name="ci", columns={"code","id"}), + * @Index (name="id", columns={"id"}) + * } + * ) + */ +class AttributeTranslation extends \XLite\Model\Base\Translation +{ + /** + * Name + * + * @var string + * + * @Column (type="string", length=255) + */ + protected $name; + + /** + * Unit + * + * @var string + * @see ____var_see____ + * @since 1.0.0 + * + * @Column (type="string", length=255) + */ + protected $unit = ''; + +} diff --git a/src/classes/XLite/Model/AttributeValue/AAttributeValue.php b/src/classes/XLite/Model/AttributeValue/AAttributeValue.php new file mode 100644 index 0000000000..7d8bd307a7 --- /dev/null +++ b/src/classes/XLite/Model/AttributeValue/AAttributeValue.php @@ -0,0 +1,65 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\Model\AttributeValue; + +/** + * Abstract attribute value + * + * @MappedSuperclass + */ +abstract class AAttributeValue extends \XLite\Model\AEntity +{ + /** + * ID + * + * @var integer + * + * @Id + * @GeneratedValue (strategy="AUTO") + * @Column (type="uinteger") + */ + protected $id; + + /** + * Product + * + * @var \XLite\Model\Product + * + * @ManyToOne (targetEntity="XLite\Model\Product") + * @JoinColumn (name="product_id", referencedColumnName="product_id") + */ + protected $product; + + /** + * Attribute + * + * @var \XLite\Model\Attribute + * + * @ManyToOne (targetEntity="XLite\Model\Attribute") + * @JoinColumn (name="attribute_id", referencedColumnName="id") + */ + protected $attribute; +} diff --git a/src/classes/XLite/Model/AttributeValue/AttributeValueCheckbox.php b/src/classes/XLite/Model/AttributeValue/AttributeValueCheckbox.php new file mode 100644 index 0000000000..560ea05954 --- /dev/null +++ b/src/classes/XLite/Model/AttributeValue/AttributeValueCheckbox.php @@ -0,0 +1,50 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\Model\AttributeValue; + +/** + * Attribute value (checkbox) + * + * @Entity (repositoryClass="\XLite\Model\Repo\AttributeValue\AttributeValueCheckbox") + * @Table (name="attribute_values_checkbox", + * indexes={ + * @Index (name="product_id", columns={"product_id"}), + * @Index (name="attribute_id", columns={"attribute_id"}), + * @Index (name="value", columns={"value"}) + * } + * ) + */ +class AttributeValueCheckbox extends \XLite\Model\AttributeValue\AAttributeValue +{ + /** + * Value + * + * @var boolean + * + * @Column (type="boolean") + */ + protected $value = 0; +} diff --git a/src/classes/XLite/Model/AttributeValue/AttributeValueNumber.php b/src/classes/XLite/Model/AttributeValue/AttributeValueNumber.php new file mode 100644 index 0000000000..e0cf31e4e4 --- /dev/null +++ b/src/classes/XLite/Model/AttributeValue/AttributeValueNumber.php @@ -0,0 +1,50 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\Model\AttributeValue; + +/** + * Attribute value (number) + * + * @Entity (repositoryClass="\XLite\Model\Repo\AttributeValue\AttributeValueNumber") + * @Table (name="attribute_values_number", + * indexes={ + * @Index (name="product_id", columns={"product_id"}), + * @Index (name="attribute_id", columns={"attribute_id"}), + * @Index (name="value", columns={"value"}) + * } + * ) + */ +class AttributeValueNumber extends \XLite\Model\AttributeValue\AAttributeValue +{ + /** + * Value + * + * @var float + * + * @Column (type="decimal", precision=14, scale=4) + */ + protected $value = 0; +} diff --git a/src/classes/XLite/Model/AttributeValue/AttributeValueSelect.php b/src/classes/XLite/Model/AttributeValue/AttributeValueSelect.php new file mode 100644 index 0000000000..8ad6158e55 --- /dev/null +++ b/src/classes/XLite/Model/AttributeValue/AttributeValueSelect.php @@ -0,0 +1,51 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\Model\AttributeValue; + +/** + * Attribute value (select) + * + * @Entity (repositoryClass="\XLite\Model\Repo\AttributeValue\AttributeValueSelect") + * @Table (name="attribute_values_select", + * indexes={ + * @Index (name="product_id", columns={"product_id"}), + * @Index (name="attribute_id", columns={"attribute_id"}), + * @Index (name="attribute_option_id", columns={"attribute_option_id"}) + * } + * ) + */ +class AttributeValueSelect extends \XLite\Model\AttributeValue\AAttributeValue +{ + /** + * Attribute option + * + * @var \XLite\Model\AttributeOption + * + * @ManyToOne (targetEntity="XLite\Model\AttributeOption") + * @JoinColumn (name="attribute_option_id", referencedColumnName="id") + */ + protected $attribute_option; +} diff --git a/src/classes/XLite/Model/AttributeValue/AttributeValueText.php b/src/classes/XLite/Model/AttributeValue/AttributeValueText.php new file mode 100644 index 0000000000..ef42289b46 --- /dev/null +++ b/src/classes/XLite/Model/AttributeValue/AttributeValueText.php @@ -0,0 +1,49 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\Model\AttributeValue; + +/** + * Attribute value (text) + * + * @Entity (repositoryClass="\XLite\Model\Repo\AttributeValue\AttributeValueText") + * @Table (name="attribute_values_text", + * indexes={ + * @Index (name="product_id", columns={"product_id"}), + * @Index (name="attribute_id", columns={"attribute_id"}) + * } + * ) + */ +class AttributeValueText extends \XLite\Model\AttributeValue\AAttributeValue +{ + /** + * Value + * + * @var text + * + * @Column (type="text") + */ + protected $value; +} diff --git a/src/classes/XLite/Model/Product.php b/src/classes/XLite/Model/Product.php index ad9e385bdc..300a93a878 100644 --- a/src/classes/XLite/Model/Product.php +++ b/src/classes/XLite/Model/Product.php @@ -193,9 +193,20 @@ class Product extends \XLite\Model\Base\Catalog implements \XLite\Model\Base\IOr * joinColumns={@JoinColumn(name="product_id", referencedColumnName="product_id")}, * inverseJoinColumns={@JoinColumn(name="class_id", referencedColumnName="id")} * ) + * @OrderBy ({"position" = "ASC"}) */ protected $classes; + /** + * Show product attributes in a separate tab + * + * @var boolean + * + * @Column (type="boolean") + */ + protected $attrSepTab = true; + + /** * Constructor * diff --git a/src/classes/XLite/Model/ProductClass.php b/src/classes/XLite/Model/ProductClass.php index bcb21eebc9..891d1759b1 100644 --- a/src/classes/XLite/Model/ProductClass.php +++ b/src/classes/XLite/Model/ProductClass.php @@ -45,6 +45,16 @@ class ProductClass extends \XLite\Model\Base\I18n */ protected $id; + /** + * Position + * + * @var integer + * @see ____var_see____ + * @since 1.0.0 + * + * @Column (type="integer") + */ + protected $position = 0; /** * Products @@ -55,7 +65,6 @@ class ProductClass extends \XLite\Model\Base\I18n */ protected $products; - /** * Shipping methods * @@ -65,6 +74,24 @@ class ProductClass extends \XLite\Model\Base\I18n */ protected $shipping_methods; + /** + * Attributes + * + * @var \Doctrine\Common\Collections\Collection + * + * @OneToMany (targetEntity="XLite\Model\Attribute", mappedBy="product_class", cascade={"all"}) + */ + protected $attributes; + + /** + * Attribute groups + * + * @var \Doctrine\Common\Collections\Collection + * + * @OneToMany (targetEntity="XLite\Model\AttributeGroup", mappedBy="product_class", cascade={"all"}) + * @OrderBy ({"position" = "ASC"}) + */ + protected $attribute_groups; /** * Constructor @@ -77,7 +104,29 @@ public function __construct(array $data = array()) { $this->products = new \Doctrine\Common\Collections\ArrayCollection(); $this->shipping_methods = new \Doctrine\Common\Collections\ArrayCollection(); + $this->attributes = new \Doctrine\Common\Collections\ArrayCollection(); + $this->attribute_groups = new \Doctrine\Common\Collections\ArrayCollection(); parent::__construct($data); } + + /** + * Return number of products associated with this class + * + * @return integer + */ + public function getProductsCount() + { + return count($this->getProducts()); + } + + /** + * Return number of attributes associated with this class + * + * @return integer + */ + public function getAttributesCount() + { + return count($this->getAttributes()); + } } diff --git a/src/classes/XLite/Model/Repo/Attribute.php b/src/classes/XLite/Model/Repo/Attribute.php new file mode 100644 index 0000000000..923bcc8693 --- /dev/null +++ b/src/classes/XLite/Model/Repo/Attribute.php @@ -0,0 +1,196 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\Model\Repo; + +/** + * Attributes repository + * + */ +class Attribute extends \XLite\Model\Repo\Base\I18n +{ + /** + * Allowable search params + */ + const SEARCH_PRODUCT = 'product'; + const SEARCH_PRODUCT_CLASS = 'productClass'; + const SEARCH_ATTRIBUTE_GROUP = 'attributeGroup'; + + // {{{ Search + + /** + * Common search + * + * @param \XLite\Core\CommonCell $cnd Search condition + * @param boolean $countOnly Return items list or only its size OPTIONAL + * + * @return \Doctrine\ORM\PersistentCollection|integer + */ + public function search(\XLite\Core\CommonCell $cnd, $countOnly = false) + { + $queryBuilder = $this->createQueryBuilder('a'); + $this->currentSearchCnd = $cnd; + + foreach ($this->currentSearchCnd as $key => $value) { + $this->callSearchConditionHandler($value, $key, $queryBuilder, $countOnly); + } + + return $countOnly + ? $this->searchCount($queryBuilder) + : $this->searchResult($queryBuilder); + } + + /** + * Search count only routine. + * + * @param \Doctrine\ORM\QueryBuilder $qb Query builder routine + * + * @return \Doctrine\ORM\PersistentCollection|integer + */ + public function searchCount(\Doctrine\ORM\QueryBuilder $qb) + { + $qb->select('COUNT(DISTINCT a.id)'); + + return intval($qb->getSingleScalarResult()); + } + + /** + * Search result routine. + * + * @param \Doctrine\ORM\QueryBuilder $qb Query builder routine + * + * @return \Doctrine\ORM\PersistentCollection|integer + */ + public function searchResult(\Doctrine\ORM\QueryBuilder $qb) + { + return $qb->addOrderBy('a.position', 'ASC')->getResult(); + } + + /** + * Call corresponded method to handle a search condition + * + * @param mixed $value Condition data + * @param string $key Condition name + * @param \Doctrine\ORM\QueryBuilder $queryBuilder Query builder to prepare + * @param boolean $countOnly Count only flag + * + * @return void + */ + protected function callSearchConditionHandler($value, $key, \Doctrine\ORM\QueryBuilder $queryBuilder, $countOnly) + { + if ($this->isSearchParamHasHandler($key)) { + $this->{'prepareCnd' . ucfirst($key)}($queryBuilder, $value, $countOnly); + } + } + + /** + * Check if param can be used for search + * + * @param string $param Name of param to check + * + * @return boolean + */ + protected function isSearchParamHasHandler($param) + { + return in_array($param, $this->getHandlingSearchParams()); + } + + /** + * Return list of handling search params + * + * @return array + */ + protected function getHandlingSearchParams() + { + return array( + static::SEARCH_PRODUCT, + static::SEARCH_PRODUCT_CLASS, + static::SEARCH_ATTRIBUTE_GROUP, + ); + } + + /** + * Prepare certain search condition + * + * @param \Doctrine\ORM\QueryBuilder $queryBuilder Query builder to prepare + * @param mixed $value Condition OPTIONAL + * + * @return void + * @see ____func_see____ + * @since 1.0.0 + */ + protected function prepareCndProduct(\Doctrine\ORM\QueryBuilder $queryBuilder, $value = null) + { + if ($value) { + $queryBuilder->linkInner('a.product_class') + ->linkInner('product_class.products') + ->andWhere('products.product_id = :productId') + ->addOrderBy('product_class.position', 'ASC') + ->setParameter('productId', $value->getProductId()); + } + } + + /** + * Prepare certain search condition + * + * @param \Doctrine\ORM\QueryBuilder $queryBuilder Query builder to prepare + * @param mixed $value Condition OPTIONAL + * + * @return void + * @see ____func_see____ + * @since 1.0.0 + */ + protected function prepareCndProductClass(\Doctrine\ORM\QueryBuilder $queryBuilder, $value = null) + { + if ($value) { + $queryBuilder->andWhere('a.product_class = :productClass') + ->setParameter('productClass', $value); + } + } + + /** + * Prepare certain search condition + * + * @param \Doctrine\ORM\QueryBuilder $queryBuilder Query builder to prepare + * @param mixed $value Condition OPTIONAL + * + * @return void + * @see ____func_see____ + * @since 1.0.0 + */ + protected function prepareCndAttributeGroup(\Doctrine\ORM\QueryBuilder $queryBuilder, $value = null) + { + if ($value) { + $queryBuilder->andWhere('a.attribute_group = :attributeGroup') + ->setParameter('attributeGroup', $value); + + } else { + $queryBuilder->andWhere('a.attribute_group is null'); + } + } + + // }}} + +} diff --git a/src/classes/XLite/Model/Repo/AttributeGroup.php b/src/classes/XLite/Model/Repo/AttributeGroup.php new file mode 100644 index 0000000000..b57edd9ef4 --- /dev/null +++ b/src/classes/XLite/Model/Repo/AttributeGroup.php @@ -0,0 +1,150 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\Model\Repo; + +/** + * Attribute groups repository + * + */ +class AttributeGroup extends \XLite\Model\Repo\Base\I18n +{ + /** + * Allowable search params + */ + const SEARCH_PRODUCT_CLASS = 'productClass'; + + // {{{ Search + + /** + * Common search + * + * @param \XLite\Core\CommonCell $cnd Search condition + * @param boolean $countOnly Return items list or only its size OPTIONAL + * + * @return \Doctrine\ORM\PersistentCollection|integer + */ + public function search(\XLite\Core\CommonCell $cnd, $countOnly = false) + { + $queryBuilder = $this->createQueryBuilder('a'); + $this->currentSearchCnd = $cnd; + + foreach ($this->currentSearchCnd as $key => $value) { + $this->callSearchConditionHandler($value, $key, $queryBuilder, $countOnly); + } + + return $countOnly + ? $this->searchCount($queryBuilder) + : $this->searchResult($queryBuilder); + } + + /** + * Search count only routine. + * + * @param \Doctrine\ORM\QueryBuilder $qb Query builder routine + * + * @return \Doctrine\ORM\PersistentCollection|integer + */ + public function searchCount(\Doctrine\ORM\QueryBuilder $qb) + { + $qb->select('COUNT(DISTINCT a.id)'); + + return intval($qb->getSingleScalarResult()); + } + + /** + * Search result routine. + * + * @param \Doctrine\ORM\QueryBuilder $qb Query builder routine + * + * @return \Doctrine\ORM\PersistentCollection|integer + */ + public function searchResult(\Doctrine\ORM\QueryBuilder $qb) + { + return $qb->addOrderBy('a.position', 'ASC')->getResult(); + } + + /** + * Call corresponded method to handle a search condition + * + * @param mixed $value Condition data + * @param string $key Condition name + * @param \Doctrine\ORM\QueryBuilder $queryBuilder Query builder to prepare + * @param boolean $countOnly Count only flag + * + * @return void + */ + protected function callSearchConditionHandler($value, $key, \Doctrine\ORM\QueryBuilder $queryBuilder, $countOnly) + { + if ($this->isSearchParamHasHandler($key)) { + $this->{'prepareCnd' . ucfirst($key)}($queryBuilder, $value, $countOnly); + } + } + + /** + * Check if param can be used for search + * + * @param string $param Name of param to check + * + * @return boolean + */ + protected function isSearchParamHasHandler($param) + { + return in_array($param, $this->getHandlingSearchParams()); + } + + /** + * Return list of handling search params + * + * @return array + */ + protected function getHandlingSearchParams() + { + return array( + static::SEARCH_PRODUCT_CLASS, + ); + } + + /** + * Prepare certain search condition + * + * @param \Doctrine\ORM\QueryBuilder $queryBuilder Query builder to prepare + * @param mixed $value Condition OPTIONAL + * + * @return void + * @see ____func_see____ + * @since 1.0.0 + */ + protected function prepareCndProductClass(\Doctrine\ORM\QueryBuilder $queryBuilder, $value = null) + { + if ($value) { + $queryBuilder->andWhere('a.product_class = :productClass') + ->setParameter('productClass', $value); + } + } + + // }}} + +} diff --git a/src/classes/XLite/Model/Repo/AttributeOption.php b/src/classes/XLite/Model/Repo/AttributeOption.php new file mode 100644 index 0000000000..56fb35b4f7 --- /dev/null +++ b/src/classes/XLite/Model/Repo/AttributeOption.php @@ -0,0 +1,190 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\Model\Repo; + +/** + * Attribute options repository + * + */ +class AttributeOption extends \XLite\Model\Repo\Base\I18n +{ + /** + * Allowable search params + */ + const SEARCH_ATTRIBUTE = 'attribute'; + const SEARCH_NAME = 'name'; + + // {{{ Search + + /** + * Common search + * + * @param \XLite\Core\CommonCell $cnd Search condition + * @param boolean $countOnly Return items list or only its size OPTIONAL + * + * @return \Doctrine\ORM\PersistentCollection|integer + */ + public function search(\XLite\Core\CommonCell $cnd, $countOnly = false) + { + $queryBuilder = $this->createQueryBuilder('a'); + $this->currentSearchCnd = $cnd; + + foreach ($this->currentSearchCnd as $key => $value) { + $this->callSearchConditionHandler($value, $key, $queryBuilder, $countOnly); + } + + return $countOnly + ? $this->searchCount($queryBuilder) + : $this->searchResult($queryBuilder); + } + + /** + * Search count only routine. + * + * @param \Doctrine\ORM\QueryBuilder $qb Query builder routine + * + * @return \Doctrine\ORM\PersistentCollection|integer + */ + public function searchCount(\Doctrine\ORM\QueryBuilder $qb) + { + $qb->select('COUNT(DISTINCT a.id)'); + + return intval($qb->getSingleScalarResult()); + } + + /** + * Search result routine. + * + * @param \Doctrine\ORM\QueryBuilder $qb Query builder routine + * + * @return \Doctrine\ORM\PersistentCollection|integer + */ + public function searchResult(\Doctrine\ORM\QueryBuilder $qb) + { + return $qb->getResult(); + } + + /** + * Find one option by name and attribute + * + * @param string $name Name + * @param \XLite\Model\Attribute $attribute Attribute + * + * @return \XLite\Model\AttributeOption + */ + public function findOneByNameAndAttribute($name, \XLite\Model\Attribute $attribute) + { + return $this->createQueryBuilder('a') + ->andWhere('translations.name = :name') + ->andWhere('a.attribute = :attribute') + ->setParameter('name', $name) + ->setParameter('attribute', $attribute) + ->setMaxResults(1) + ->getSingleResult(); + } + + /** + * Call corresponded method to handle a search condition + * + * @param mixed $value Condition data + * @param string $key Condition name + * @param \Doctrine\ORM\QueryBuilder $queryBuilder Query builder to prepare + * @param boolean $countOnly Count only flag + * + * @return void + */ + protected function callSearchConditionHandler($value, $key, \Doctrine\ORM\QueryBuilder $queryBuilder, $countOnly) + { + if ($this->isSearchParamHasHandler($key)) { + $this->{'prepareCnd' . ucfirst($key)}($queryBuilder, $value, $countOnly); + } + } + + /** + * Check if param can be used for search + * + * @param string $param Name of param to check + * + * @return boolean + */ + protected function isSearchParamHasHandler($param) + { + return in_array($param, $this->getHandlingSearchParams()); + } + + /** + * Return list of handling search params + * + * @return array + */ + protected function getHandlingSearchParams() + { + return array( + static::SEARCH_ATTRIBUTE, + static::SEARCH_NAME, + ); + } + + /** + * Prepare certain search condition + * + * @param \Doctrine\ORM\QueryBuilder $queryBuilder Query builder to prepare + * @param mixed $value Condition OPTIONAL + * + * @return void + */ + protected function prepareCndAttribute(\Doctrine\ORM\QueryBuilder $queryBuilder, $value = null) + { + if ($value) { + if (is_object($value)) { + $queryBuilder->andWhere('a.attribute = :attribute'); + + } else { + $queryBuilder->linkInner('a.attribute')->andWhere('attribute.id = :attribute'); + } + $queryBuilder->setParameter('attribute', $value); + } + } + + /** + * Prepare certain search condition + * + * @param \Doctrine\ORM\QueryBuilder $queryBuilder Query builder to prepare + * @param mixed $value Condition OPTIONAL + * + * @return void + */ + protected function prepareCndName(\Doctrine\ORM\QueryBuilder $queryBuilder, $value = null) + { + if ($value) { + $queryBuilder->andWhere('translations.name LIKE :name') + ->setParameter('name', '%' . $value . '%'); + } + } + + // }}} + +} diff --git a/src/classes/XLite/Model/Repo/AttributeValue/AAttributeValue.php b/src/classes/XLite/Model/Repo/AttributeValue/AAttributeValue.php new file mode 100644 index 0000000000..74781cf30e --- /dev/null +++ b/src/classes/XLite/Model/Repo/AttributeValue/AAttributeValue.php @@ -0,0 +1,170 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\Model\Repo\AttributeValue; + +/** + * Attribute values repository + * + */ +class AAttributeValue extends \XLite\Model\Repo\ARepo +{ + /** + * Allowable search params + */ + const SEARCH_PRODUCT = 'product'; + const SEARCH_ATTRIBUTE = 'attribute'; + + // {{{ Search + + /** + * Common search + * + * @param \XLite\Core\CommonCell $cnd Search condition + * @param boolean $countOnly Return items list or only its size OPTIONAL + * + * @return \Doctrine\ORM\PersistentCollection|integer + */ + public function search(\XLite\Core\CommonCell $cnd, $countOnly = false) + { + $queryBuilder = $this->createQueryBuilder('a'); + $this->currentSearchCnd = $cnd; + + foreach ($this->currentSearchCnd as $key => $value) { + $this->callSearchConditionHandler($value, $key, $queryBuilder, $countOnly); + } + + return $countOnly + ? $this->searchCount($queryBuilder) + : $this->searchResult($queryBuilder); + } + + /** + * Search count only routine. + * + * @param \Doctrine\ORM\QueryBuilder $qb Query builder routine + * + * @return \Doctrine\ORM\PersistentCollection|integer + */ + public function searchCount(\Doctrine\ORM\QueryBuilder $qb) + { + $qb->select('COUNT(DISTINCT a.id)'); + + return intval($qb->getSingleScalarResult()); + } + + /** + * Search result routine. + * + * @param \Doctrine\ORM\QueryBuilder $qb Query builder routine + * + * @return \Doctrine\ORM\PersistentCollection|integer + */ + public function searchResult(\Doctrine\ORM\QueryBuilder $qb) + { + return $qb->getResult(); + } + + /** + * Call corresponded method to handle a search condition + * + * @param mixed $value Condition data + * @param string $key Condition name + * @param \Doctrine\ORM\QueryBuilder $queryBuilder Query builder to prepare + * @param boolean $countOnly Count only flag + * + * @return void + */ + protected function callSearchConditionHandler($value, $key, \Doctrine\ORM\QueryBuilder $queryBuilder, $countOnly) + { + if ($this->isSearchParamHasHandler($key)) { + $this->{'prepareCnd' . ucfirst($key)}($queryBuilder, $value, $countOnly); + } + } + + /** + * Check if param can be used for search + * + * @param string $param Name of param to check + * + * @return boolean + */ + protected function isSearchParamHasHandler($param) + { + return in_array($param, $this->getHandlingSearchParams()); + } + + /** + * Return list of handling search params + * + * @return array + */ + protected function getHandlingSearchParams() + { + return array( + static::SEARCH_PRODUCT, + static::SEARCH_ATTRIBUTE, + ); + } + + /** + * Prepare certain search condition + * + * @param \Doctrine\ORM\QueryBuilder $queryBuilder Query builder to prepare + * @param mixed $value Condition OPTIONAL + * + * @return void + * @see ____func_see____ + * @since 1.0.0 + */ + protected function prepareCndProduct(\Doctrine\ORM\QueryBuilder $queryBuilder, $value = null) + { + if ($value) { + $queryBuilder->andWhere('a.product = :product') + ->setParameter('product', $value); + } + } + + /** + * Prepare certain search condition + * + * @param \Doctrine\ORM\QueryBuilder $queryBuilder Query builder to prepare + * @param mixed $value Condition OPTIONAL + * + * @return void + * @see ____func_see____ + * @since 1.0.0 + */ + protected function prepareCndAttribute(\Doctrine\ORM\QueryBuilder $queryBuilder, $value = null) + { + if ($value) { + $queryBuilder->andWhere('a.attribute = :attribute') + ->setParameter('attribute', $value); + } + } + + // }}} + +} diff --git a/src/classes/XLite/Model/Repo/AttributeValue/AttributeValueCheckbox.php b/src/classes/XLite/Model/Repo/AttributeValue/AttributeValueCheckbox.php new file mode 100644 index 0000000000..abcda37b26 --- /dev/null +++ b/src/classes/XLite/Model/Repo/AttributeValue/AttributeValueCheckbox.php @@ -0,0 +1,34 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\Model\Repo\AttributeValue; + +/** + * Attribute values repository + * + */ +class AttributeValueCheckbox extends \XLite\Model\Repo\AttributeValue\AAttributeValue +{ +} diff --git a/src/classes/XLite/Model/Repo/AttributeValue/AttributeValueNumber.php b/src/classes/XLite/Model/Repo/AttributeValue/AttributeValueNumber.php new file mode 100644 index 0000000000..14e64c63ba --- /dev/null +++ b/src/classes/XLite/Model/Repo/AttributeValue/AttributeValueNumber.php @@ -0,0 +1,34 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\Model\Repo\AttributeValue; + +/** + * Attribute values repository + * + */ +class AttributeValueNumber extends \XLite\Model\Repo\AttributeValue\AAttributeValue +{ +} diff --git a/src/classes/XLite/Model/Repo/AttributeValue/AttributeValueSelect.php b/src/classes/XLite/Model/Repo/AttributeValue/AttributeValueSelect.php new file mode 100644 index 0000000000..8aa14c2804 --- /dev/null +++ b/src/classes/XLite/Model/Repo/AttributeValue/AttributeValueSelect.php @@ -0,0 +1,67 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\Model\Repo\AttributeValue; + +/** + * Attribute values repository + * + */ +class AttributeValueSelect extends \XLite\Model\Repo\AttributeValue\AAttributeValue +{ + /** + * Allowable search params + */ + const SEARCH_ATTRIBUTE_OPTION = 'attributeOption'; + + /** + * Return list of handling search params + * + * @return array + */ + protected function getHandlingSearchParams() + { + return parent::getHandlingSearchParams() + array(static::SEARCH_ATTRIBUTE_OPTION); + } + + /** + * Prepare certain search condition + * + * @param \Doctrine\ORM\QueryBuilder $queryBuilder Query builder to prepare + * @param mixed $value Condition OPTIONAL + * + * @return void + * @see ____func_see____ + * @since 1.0.0 + */ + protected function prepareCndAttributeOption(\Doctrine\ORM\QueryBuilder $queryBuilder, $value = null) + { + if ($value) { + $queryBuilder->andWhere('a.attribute_option = :attributeOption') + ->setParameter('attributeOption', $value); + } + } + +} diff --git a/src/classes/XLite/Model/Repo/AttributeValue/AttributeValueText.php b/src/classes/XLite/Model/Repo/AttributeValue/AttributeValueText.php new file mode 100644 index 0000000000..c46ae10916 --- /dev/null +++ b/src/classes/XLite/Model/Repo/AttributeValue/AttributeValueText.php @@ -0,0 +1,34 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\Model\Repo\AttributeValue; + +/** + * Attribute values repository + * + */ +class AttributeValueText extends \XLite\Model\Repo\AttributeValue\AAttributeValue +{ +} diff --git a/src/classes/XLite/Model/Repo/ProductClass.php b/src/classes/XLite/Model/Repo/ProductClass.php index 580fdd9c9b..c82a7245be 100644 --- a/src/classes/XLite/Model/Repo/ProductClass.php +++ b/src/classes/XLite/Model/Repo/ProductClass.php @@ -26,9 +26,105 @@ namespace XLite\Model\Repo; /** - * The product classes model repository + * Product classes repository * */ class ProductClass extends \XLite\Model\Repo\Base\I18n { + + // {{{ Search + + + /** + * Common search + * + * @param \XLite\Core\CommonCell $cnd Search condition + * @param boolean $countOnly Return items list or only its size OPTIONAL + * + * @return \Doctrine\ORM\PersistentCollection|integer + */ + public function search(\XLite\Core\CommonCell $cnd, $countOnly = false) + { + $queryBuilder = $this->createQueryBuilder('p'); + $this->currentSearchCnd = $cnd; + + foreach ($this->currentSearchCnd as $key => $value) { + $this->callSearchConditionHandler($value, $key, $queryBuilder, $countOnly); + } + + return $countOnly + ? $this->searchCount($queryBuilder) + : $this->searchResult($queryBuilder); + } + + /** + * Search count only routine. + * + * @param \Doctrine\ORM\QueryBuilder $qb Query builder routine + * + * @return \Doctrine\ORM\PersistentCollection|integer + */ + public function searchCount(\Doctrine\ORM\QueryBuilder $qb) + { + $qb->select('COUNT(DISTINCT p.id)'); + + return intval($qb->getSingleScalarResult()); + } + + /** + * Search result routine. + * + * @param \Doctrine\ORM\QueryBuilder $qb Query builder routine + * + * @return \Doctrine\ORM\PersistentCollection|integer + */ + public function searchResult(\Doctrine\ORM\QueryBuilder $qb) + { + return $qb->addOrderBy('p.position', 'ASC')->getResult(); + } + + /** + * Call corresponded method to handle a search condition + * + * @param mixed $value Condition data + * @param string $key Condition name + * @param \Doctrine\ORM\QueryBuilder $queryBuilder Query builder to prepare + * @param boolean $countOnly Count only flag + * + * @return void + */ + protected function callSearchConditionHandler($value, $key, \Doctrine\ORM\QueryBuilder $queryBuilder, $countOnly) + { + if ($this->isSearchParamHasHandler($key)) { + $this->{'prepareCnd' . ucfirst($key)}($queryBuilder, $value, $countOnly); + } + } + + /** + * Check if param can be used for search + * + * @param string $param Name of param to check + * + * @return boolean + */ + protected function isSearchParamHasHandler($param) + { + return in_array($param, $this->getHandlingSearchParams()); + } + + /** + * Return list of handling search params + * + * @return array + */ + protected function getHandlingSearchParams() + { + return array( + + ); + } + + + // }}} + } diff --git a/src/classes/XLite/View/Attribute.php b/src/classes/XLite/View/Attribute.php new file mode 100644 index 0000000000..4d4231a115 --- /dev/null +++ b/src/classes/XLite/View/Attribute.php @@ -0,0 +1,56 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View; + +/** + * Attribute page view + * + * + * @ListChild (list="admin.center", zone="admin") + */ +class Attribute extends \XLite\View\AView +{ + /** + * Return list of allowed targets + * + * @return array + */ + public static function getAllowedTargets() + { + return array_merge(parent::getAllowedTargets(), array('attribute')); + } + + /** + * Return widget default template + * + * @return string + */ + protected function getDefaultTemplate() + { + return 'attribute/body.tpl'; + } + +} \ No newline at end of file diff --git a/src/classes/XLite/View/AttributeGroup.php b/src/classes/XLite/View/AttributeGroup.php new file mode 100644 index 0000000000..1be7467f07 --- /dev/null +++ b/src/classes/XLite/View/AttributeGroup.php @@ -0,0 +1,56 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View; + +/** + * Attribute group page view + * + * + * @ListChild (list="admin.center", zone="admin") + */ +class AttributeGroup extends \XLite\View\AView +{ + /** + * Return list of allowed targets + * + * @return array + */ + public static function getAllowedTargets() + { + return array_merge(parent::getAllowedTargets(), array('attribute_group')); + } + + /** + * Return widget default template + * + * @return string + */ + protected function getDefaultTemplate() + { + return 'attribute_group/body.tpl'; + } + +} \ No newline at end of file diff --git a/src/classes/XLite/View/AttributeGroups.php b/src/classes/XLite/View/AttributeGroups.php new file mode 100644 index 0000000000..3c56dc53a2 --- /dev/null +++ b/src/classes/XLite/View/AttributeGroups.php @@ -0,0 +1,66 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View; + +/** + * Attribute groups page view + * + * + * @ListChild (list="admin.center", zone="admin") + */ +class AttributeGroups extends \XLite\View\AView +{ + /** + * Return list of allowed targets + * + * @return array + */ + public static function getAllowedTargets() + { + return array_merge(parent::getAllowedTargets(), array('attribute_groups')); + } + + /** + * Return widget default template + * + * @return string + */ + protected function getDefaultTemplate() + { + return 'attribute_groups/body.tpl'; + } + + /** + * Check - search box is visible or not + * + * @return boolean + */ + protected function isSearchVisible() + { + return 0 < \XLite\Core\Database::getRepo('XLite\Model\AttributeGroup')->count(); + } + +} \ No newline at end of file diff --git a/src/classes/XLite/View/AttributeOption.php b/src/classes/XLite/View/AttributeOption.php new file mode 100644 index 0000000000..ed97f0a972 --- /dev/null +++ b/src/classes/XLite/View/AttributeOption.php @@ -0,0 +1,56 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View; + +/** + * Attribute option page view + * + * + * @ListChild (list="admin.center", zone="admin") + */ +class AttributeOption extends \XLite\View\AView +{ + /** + * Return list of allowed targets + * + * @return array + */ + public static function getAllowedTargets() + { + return array_merge(parent::getAllowedTargets(), array('attribute_option')); + } + + /** + * Return widget default template + * + * @return string + */ + protected function getDefaultTemplate() + { + return 'attribute_option/body.tpl'; + } + +} \ No newline at end of file diff --git a/src/classes/XLite/View/AttributeOptions.php b/src/classes/XLite/View/AttributeOptions.php new file mode 100644 index 0000000000..22804d60bb --- /dev/null +++ b/src/classes/XLite/View/AttributeOptions.php @@ -0,0 +1,66 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View; + +/** + * Attribute options page view + * + * + * @ListChild (list="admin.center", zone="admin") + */ +class AttributeOptions extends \XLite\View\AView +{ + /** + * Return list of allowed targets + * + * @return array + */ + public static function getAllowedTargets() + { + return array_merge(parent::getAllowedTargets(), array('attribute_options')); + } + + /** + * Return widget default template + * + * @return string + */ + protected function getDefaultTemplate() + { + return 'attribute_options/body.tpl'; + } + + /** + * Check - search box is visible or not + * + * @return boolean + */ + protected function isSearchVisible() + { + return 0 < \XLite\Core\Database::getRepo('XLite\Model\AttributeOption')->count(); + } + +} \ No newline at end of file diff --git a/src/classes/XLite/View/Attributes.php b/src/classes/XLite/View/Attributes.php new file mode 100644 index 0000000000..0ac1100cd7 --- /dev/null +++ b/src/classes/XLite/View/Attributes.php @@ -0,0 +1,123 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View; + +/** + * Attributes page view + * + * + * @ListChild (list="admin.center", zone="admin") + */ +class Attributes extends \XLite\View\AView +{ + /** + * Return list of allowed targets + * + * @return array + */ + public static function getAllowedTargets() + { + return array_merge(parent::getAllowedTargets(), array('attributes')); + } + + /** + * Get a list of CSS files required to display the widget properly + * + * @return array + */ + public function getCSSFiles() + { + $list = parent::getCSSFiles(); + + $list[] = 'attributes/style.css'; + $list[] = 'form_field/inline/style.css'; + $list[] = 'form_field/inline/input/text/position/move.css'; + $list[] = 'form_field/inline/input/text/position.css'; + $list[] = 'form_field/form_field.css'; + $list[] = 'form_field/input/text/position.css'; + $list[] = 'items_list/items_list.css'; + $list[] = 'items_list/model/style.css'; + $list[] = 'items_list/model/table/style.css'; + + return $list; + } + + /** + * Get a list of JavaScript files required to display the widget properly + * + * @return array + */ + public function getJSFiles() + { + $list = parent::getJSFiles(); + + $list[] = 'attributes/script.js'; + $list[] = 'form_field/inline/controller.js'; + $list[] = 'form_field/inline/input/text/position/move.js'; + $list[] = 'form_field/js/text.js'; + $list[] = 'form_field/input/text/integer.js'; + $list[] = 'button/js/remove.js'; + $list[] = 'items_list/items_list.js'; + $list[] = 'items_list/model/table/controller.js'; + + return $list; + } + + /** + * Register files from common repository + * + * @return array + */ + public function getCommonFiles() + { + $list = parent::getCommonFiles(); + $list['js'][] = 'js/jquery.blockUI.js'; + $list['js'][] = 'js/jquery.textarea-expander.js'; + + return $list; + } + + /** + * Return widget default template + * + * @return string + */ + protected function getDefaultTemplate() + { + return 'attributes/body.tpl'; + } + + /** + * Check - search box is visible or not + * + * @return boolean + */ + protected function isSearchVisible() + { + return 0 < \XLite\Core\Database::getRepo('XLite\Model\Attribute')->count(); + } + +} diff --git a/src/classes/XLite/View/Form/ItemsList/Attribute/Table.php b/src/classes/XLite/View/Form/ItemsList/Attribute/Table.php new file mode 100644 index 0000000000..445d6fe909 --- /dev/null +++ b/src/classes/XLite/View/Form/ItemsList/Attribute/Table.php @@ -0,0 +1,66 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\Form\ItemsList\Attribute; + +/** + * Attributes list table form + * + */ +class Table extends \XLite\View\Form\ItemsList\AItemsList +{ + /** + * Return default value for the "target" parameter + * + * @return string + */ + protected function getDefaultTarget() + { + return 'attributes'; + } + + /** + * Return default value for the "action" parameter + * + * @return string + */ + protected function getDefaultAction() + { + return 'update'; + } + + /** + * Return list of the form default parameters + * + * @return array + */ + protected function getDefaultParams() + { + return array( + 'product_class_id' => intval(\XLite\Core\Request::getInstance()->product_class_id), + ); + } + +} diff --git a/src/classes/XLite/View/Form/ItemsList/AttributeGroup/Table.php b/src/classes/XLite/View/Form/ItemsList/AttributeGroup/Table.php new file mode 100644 index 0000000000..2aa3444dbf --- /dev/null +++ b/src/classes/XLite/View/Form/ItemsList/AttributeGroup/Table.php @@ -0,0 +1,66 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\Form\ItemsList\AttributeGroup; + +/** + * Attribute groups list table form + * + */ +class Table extends \XLite\View\Form\ItemsList\AItemsList +{ + /** + * Return default value for the "target" parameter + * + * @return string + */ + protected function getDefaultTarget() + { + return 'attribute_groups'; + } + + /** + * Return default value for the "action" parameter + * + * @return string + */ + protected function getDefaultAction() + { + return 'update'; + } + + /** + * Return list of the form default parameters + * + * @return array + */ + protected function getDefaultParams() + { + return array( + 'product_class_id' => intval(\XLite\Core\Request::getInstance()->product_class_id), + ); + } + +} diff --git a/src/classes/XLite/View/Form/ItemsList/AttributeOption/Table.php b/src/classes/XLite/View/Form/ItemsList/AttributeOption/Table.php new file mode 100644 index 0000000000..312bb3e438 --- /dev/null +++ b/src/classes/XLite/View/Form/ItemsList/AttributeOption/Table.php @@ -0,0 +1,53 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\Form\ItemsList\AttributeOption; + +/** + * Attribute options list table form + * + */ +class Table extends \XLite\View\Form\ItemsList\AItemsList +{ + /** + * Return default value for the "target" parameter + * + * @return string + */ + protected function getDefaultTarget() + { + return 'attribute_options'; + } + + /** + * Return default value for the "action" parameter + * + * @return string + */ + protected function getDefaultAction() + { + return 'update'; + } +} \ No newline at end of file diff --git a/src/classes/XLite/View/Form/ItemsList/ProductClass/Table.php b/src/classes/XLite/View/Form/ItemsList/ProductClass/Table.php new file mode 100644 index 0000000000..1543aac31e --- /dev/null +++ b/src/classes/XLite/View/Form/ItemsList/ProductClass/Table.php @@ -0,0 +1,53 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\Form\ItemsList\ProductClass; + +/** + * Product classes list table form + * + */ +class Table extends \XLite\View\Form\ItemsList\AItemsList +{ + /** + * Return default value for the "target" parameter + * + * @return string + */ + protected function getDefaultTarget() + { + return 'product_classes'; + } + + /** + * Return default value for the "action" parameter + * + * @return string + */ + protected function getDefaultAction() + { + return 'update'; + } +} \ No newline at end of file diff --git a/src/classes/XLite/View/Form/Model/Attribute.php b/src/classes/XLite/View/Form/Model/Attribute.php new file mode 100644 index 0000000000..da64f1c820 --- /dev/null +++ b/src/classes/XLite/View/Form/Model/Attribute.php @@ -0,0 +1,91 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\Form\Model; + +/** + * Attributes list search form + * + */ +class Attribute extends \XLite\View\Form\AForm +{ + /** + * Register CSS files + * + * @return array + */ + public function getCSSFiles() + { + $list = parent::getCSSFiles(); + + $list[] = 'attribute/style.css'; + + return $list; + } + + /** + * Return default value for the "target" parameter + * + * @return string + */ + protected function getDefaultTarget() + { + return 'attribute'; + } + + /** + * Return default value for the "action" parameter + * + * @return string + */ + protected function getDefaultAction() + { + return 'update'; + } + + /** + * Get default class name + * + * @return string + */ + protected function getDefaultClassName() + { + return trim(parent::getDefaultClassName() . ' validationEngine attribute'); + } + + /** + * Return list of the form default parameters + * + * @return array + */ + protected function getDefaultParams() + { + return array( + 'id' => \XLite\Core\Request::getInstance()->id, + 'product_class_id' => \XLite\Core\Request::getInstance()->product_class_id, + ); + } + +} diff --git a/src/classes/XLite/View/Form/Model/AttributeGroup.php b/src/classes/XLite/View/Form/Model/AttributeGroup.php new file mode 100644 index 0000000000..8a821e1082 --- /dev/null +++ b/src/classes/XLite/View/Form/Model/AttributeGroup.php @@ -0,0 +1,90 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\Form\Model; + +/** + * Attribute groups list search form + * + */ +class AttributeGroup extends \XLite\View\Form\AForm +{ + /** + * Register CSS files + * + * @return array + */ + public function getCSSFiles() + { + $list = parent::getCSSFiles(); + + $list[] = 'attribute_group/style.css'; + + return $list; + } + + /** + * Return default value for the "target" parameter + * + * @return string + */ + protected function getDefaultTarget() + { + return 'attribute_group'; + } + + /** + * Return default value for the "action" parameter + * + * @return string + */ + protected function getDefaultAction() + { + return 'update'; + } + + /** + * Get default class name + * + * @return string + */ + protected function getDefaultClassName() + { + return trim(parent::getDefaultClassName() . ' validationEngine attribute-group'); + } + + /** + * Return list of the form default parameters + * + * @return array + */ + protected function getDefaultParams() + { + return array( + 'id' => \XLite\Core\Request::getInstance()->id, + ); + } + +} \ No newline at end of file diff --git a/src/classes/XLite/View/Form/Model/AttributeOption.php b/src/classes/XLite/View/Form/Model/AttributeOption.php new file mode 100644 index 0000000000..28642ca745 --- /dev/null +++ b/src/classes/XLite/View/Form/Model/AttributeOption.php @@ -0,0 +1,90 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\Form\Model; + +/** + * Attribute options list search form + * + */ +class AttributeOption extends \XLite\View\Form\AForm +{ + /** + * Register CSS files + * + * @return array + */ + public function getCSSFiles() + { + $list = parent::getCSSFiles(); + + $list[] = 'attribute_option/style.css'; + + return $list; + } + + /** + * Return default value for the "target" parameter + * + * @return string + */ + protected function getDefaultTarget() + { + return 'attribute_option'; + } + + /** + * Return default value for the "action" parameter + * + * @return string + */ + protected function getDefaultAction() + { + return 'update'; + } + + /** + * Get default class name + * + * @return string + */ + protected function getDefaultClassName() + { + return trim(parent::getDefaultClassName() . ' validationEngine attribute-option'); + } + + /** + * Return list of the form default parameters + * + * @return array + */ + protected function getDefaultParams() + { + return array( + 'id' => \XLite\Core\Request::getInstance()->id, + ); + } + +} \ No newline at end of file diff --git a/src/classes/XLite/View/Form/Model/ProductClass.php b/src/classes/XLite/View/Form/Model/ProductClass.php new file mode 100644 index 0000000000..2f83ce9b9f --- /dev/null +++ b/src/classes/XLite/View/Form/Model/ProductClass.php @@ -0,0 +1,90 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\Form\Model; + +/** + * Product classes list search form + * + */ +class ProductClass extends \XLite\View\Form\AForm +{ + /** + * Register CSS files + * + * @return array + */ + public function getCSSFiles() + { + $list = parent::getCSSFiles(); + + $list[] = 'product_class/style.css'; + + return $list; + } + + /** + * Return default value for the "target" parameter + * + * @return string + */ + protected function getDefaultTarget() + { + return 'product_class'; + } + + /** + * Return default value for the "action" parameter + * + * @return string + */ + protected function getDefaultAction() + { + return 'update'; + } + + /** + * Get default class name + * + * @return string + */ + protected function getDefaultClassName() + { + return trim(parent::getDefaultClassName() . ' validationEngine product-class'); + } + + /** + * Return list of the form default parameters + * + * @return array + */ + protected function getDefaultParams() + { + return array( + 'id' => \XLite\Core\Request::getInstance()->id, + ); + } + +} \ No newline at end of file diff --git a/src/classes/XLite/View/Form/Product/Modify/Attributes.php b/src/classes/XLite/View/Form/Product/Modify/Attributes.php new file mode 100644 index 0000000000..a59648a6c4 --- /dev/null +++ b/src/classes/XLite/View/Form/Product/Modify/Attributes.php @@ -0,0 +1,43 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\Form\Product\Modify; + +/** + * Attributes + * + */ +class Attributes extends \XLite\View\Form\Product\Modify\Base\Single +{ + /** + * Get default action + * + * @return string + */ + protected function getDefaultAction() + { + return 'update_attributes'; + } +} diff --git a/src/classes/XLite/View/FormField/AFormField.php b/src/classes/XLite/View/FormField/AFormField.php index aa47ab9592..50f2cc7aee 100644 --- a/src/classes/XLite/View/FormField/AFormField.php +++ b/src/classes/XLite/View/FormField/AFormField.php @@ -50,14 +50,15 @@ abstract class AFormField extends \XLite\View\AView /** * Available field types */ - const FIELD_TYPE_LABEL = 'label'; - const FIELD_TYPE_TEXT = 'text'; - const FIELD_TYPE_PASSWORD = 'password'; - const FIELD_TYPE_SELECT = 'select'; - const FIELD_TYPE_CHECKBOX = 'checkbox'; - const FIELD_TYPE_RADIO = 'radio'; - const FIELD_TYPE_TEXTAREA = 'textarea'; - const FIELD_TYPE_SEPARATOR = 'separator'; + const FIELD_TYPE_LABEL = 'label'; + const FIELD_TYPE_TEXT = 'text'; + const FIELD_TYPE_PASSWORD = 'password'; + const FIELD_TYPE_SELECT = 'select'; + const FIELD_TYPE_CHECKBOX = 'checkbox'; + const FIELD_TYPE_RADIO = 'radio'; + const FIELD_TYPE_TEXTAREA = 'textarea'; + const FIELD_TYPE_SEPARATOR = 'separator'; + const FIELD_TYPE_ITEMS_LIST = 'itemsList'; /** * name diff --git a/src/classes/XLite/View/FormField/Inline/Input/Text/ProductClass.php b/src/classes/XLite/View/FormField/Inline/Input/Text/ProductClass.php new file mode 100644 index 0000000000..bacd573e47 --- /dev/null +++ b/src/classes/XLite/View/FormField/Inline/Input/Text/ProductClass.php @@ -0,0 +1,79 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\FormField\Inline\Input\Text; + +/** + * Product class + * + */ +class ProductClass extends \XLite\View\FormField\Inline\Base\Single +{ + /** + * Register JS files + * + * @return array + */ + public function getJSFiles() + { + $list = parent::getJSFiles(); + + $list[] = 'form_field/inline/input/text/product-class.js'; + + return $list; + } + + /** + * Define form field + * + * @return string + */ + protected function defineFieldClass() + { + return 'XLite\View\FormField\Input\Text'; + } + + /** + * Get container class + * + * @return string + */ + protected function getContainerClass() + { + return parent::getContainerClass() . ' inline-product-class'; + } + + /** + * Get view template + * + * @return string + */ + protected function getViewTemplate() + { + return 'form_field/inline/input/text/product-class.tpl'; + } + +} + diff --git a/src/classes/XLite/View/ProductClass/AProductClass.php b/src/classes/XLite/View/FormField/Input/Radio.php similarity index 76% rename from src/classes/XLite/View/ProductClass/AProductClass.php rename to src/classes/XLite/View/FormField/Input/Radio.php index 5a8e30a50d..33840ca47f 100644 --- a/src/classes/XLite/View/ProductClass/AProductClass.php +++ b/src/classes/XLite/View/FormField/Input/Radio.php @@ -23,31 +23,31 @@ * @link http://www.litecommerce.com/ */ -namespace XLite\View\ProductClass; +namespace XLite\View\FormField\Input; /** - * Product class + * Radio * */ -abstract class AProductClass extends \XLite\View\Dialog +class Radio extends \XLite\View\FormField\Input\Checkbox { /** - * Return title + * Return field type * * @return string */ - protected function getHead() + public function getFieldType() { - return 'Product classes'; + return self::FIELD_TYPE_RADIO; } /** - * Return templates directory + * Return field template * * @return string */ - protected function getDir() + protected function getFieldTemplate() { - return 'product_classes'; + return 'radio.tpl'; } } diff --git a/src/classes/XLite/View/FormField/Input/Text/AttributeOption.php b/src/classes/XLite/View/FormField/Input/Text/AttributeOption.php new file mode 100644 index 0000000000..4659e2f575 --- /dev/null +++ b/src/classes/XLite/View/FormField/Input/Text/AttributeOption.php @@ -0,0 +1,91 @@ + + * @copyright Copyright (c) 2011 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\FormField\Input\Text; + +/** + * Atutribute option + * + */ +class AttributeOption extends \XLite\View\FormField\Input\Text\Base\Combobox +{ + /** + * Common params + */ + const PARAM_ATTRIBUTE = 'attribute'; + + /** + * Define widget params + * + * @return void + */ + protected function defineWidgetParams() + { + parent::defineWidgetParams(); + + $this->widgetParams += array( + self::PARAM_ATTRIBUTE => new \XLite\Model\WidgetParam\Object( + 'Attribute', null, false, 'XLite\Model\Attribute' + ), + ); + } + + /** + * Get URL + * + * @return string + */ + protected function getURL() + { + return parent::getURL() . '&id=' + . $this->getParam(self::PARAM_ATTRIBUTE)->getId(); + } + + /** + * Set value + * + * @param mixed $value Value to set + * + * @return void + */ + public function setValue($value) + { + if ($value && is_object($value) && $value instanceOf \XLite\Model\AttributeOption) { + $value = $value->getName(); + } + + parent::setValue($value); + } + + /** + * Get dictionary name + * + * @return string + */ + protected function getDictionary() + { + return 'attributeOption'; + } +} diff --git a/src/classes/XLite/View/FormField/Input/Text/Base/Autocomplete.php b/src/classes/XLite/View/FormField/Input/Text/Base/Autocomplete.php index aead0d936e..db3d938222 100644 --- a/src/classes/XLite/View/FormField/Input/Text/Base/Autocomplete.php +++ b/src/classes/XLite/View/FormField/Input/Text/Base/Autocomplete.php @@ -69,7 +69,7 @@ protected function assembleClasses(array $classes) } /** - * setCommonAttributes + * Set common attributes * * @param array $attrs Field attributes to prepare * diff --git a/src/classes/XLite/View/ProductClass/ProductClassesList.php b/src/classes/XLite/View/FormField/Input/Text/Base/Combobox.php similarity index 60% rename from src/classes/XLite/View/ProductClass/ProductClassesList.php rename to src/classes/XLite/View/FormField/Input/Text/Base/Combobox.php index 52cc5c7f2c..0f91bec0b0 100644 --- a/src/classes/XLite/View/ProductClass/ProductClassesList.php +++ b/src/classes/XLite/View/FormField/Input/Text/Base/Combobox.php @@ -23,32 +23,16 @@ * @link http://www.litecommerce.com/ */ -namespace XLite\View\ProductClass; +namespace XLite\View\FormField\Input\Text\Base; /** - * Product classes list - * - * - * @ListChild (list="admin.center", zone="admin") + * Combobox + * */ -class ProductClassesList extends AProductClass +abstract class Combobox extends \XLite\View\FormField\Input\Text\Base\Autocomplete { /** - * Return allowed targets - * - * @return array - */ - public static function getAllowedTargets() - { - $result = parent::getAllowedTargets(); - - $result[] = 'product_classes'; - - return $result; - } - - /** - * Return CSS files list for widget + * Get a list of CSS files required to display the widget properly * * @return array */ @@ -56,43 +40,48 @@ public function getCSSFiles() { $list = parent::getCSSFiles(); - $list[] = $this->getDir() . LC_DS . 'css' . LC_DS . 'style.css'; + $list[] = $this->getDir() . '/input/text/combobox.css'; return $list; } /** - * Return JS files list for widget + * Register JS files * - * @return void + * @return array */ public function getJSFiles() { $list = parent::getJSFiles(); - $list[] = $this->getDir() . LC_DS . 'js' . LC_DS . 'script.js'; + $list[] = 'form_field/input/text/combobox.js'; return $list; } - /** - * Return templates catalog + * Return field template * * @return string */ - protected function getDir() + protected function getFieldTemplate() { - return parent::getDir() . LC_DS . 'list'; + return 'input/text/combobox.tpl'; } /** - * Return data + * Assemble classes + * + * @param array $classes Classes * * @return array */ - protected function getData() + protected function assembleClasses(array $classes) { - return \XLite\Core\Database::getRepo('\XLite\Model\ProductClass')->findAll(); + $classes = parent::assembleClasses($classes); + + $classes[] = 'combobox'; + + return $classes; } } diff --git a/src/classes/XLite/View/ProductClass/MainInput.php b/src/classes/XLite/View/FormField/ItemsList.php similarity index 61% rename from src/classes/XLite/View/ProductClass/MainInput.php rename to src/classes/XLite/View/FormField/ItemsList.php index 693f59a467..2a143f7f38 100644 --- a/src/classes/XLite/View/ProductClass/MainInput.php +++ b/src/classes/XLite/View/FormField/ItemsList.php @@ -23,34 +23,41 @@ * @link http://www.litecommerce.com/ */ -namespace XLite\View\ProductClass; +namespace XLite\View\FormField; /** - * Product classes main input widget + * Items list * */ -class MainInput extends \XLite\View\AView +class ItemsList extends \XLite\View\FormField\AFormField { - - const CLASS_NAME = 'className'; - const CLASS_ID = 'classId'; + /** + * Widget parameters + */ + const PARAM_LIST_CLASS = 'listClass'; /** - * Return allowed targets + * Return field type * - * @return array + * @return string */ - public static function getAllowedTargets() + public function getFieldType() { - $result = parent::getAllowedTargets(); - - $result[] = 'product_classes'; + return self::FIELD_TYPE_ITEMS_LIST; + } - return $result; + /** + * Return field template + * + * @return string + */ + protected function getFieldTemplate() + { + return 'items_list.tpl'; } /** - * Define widget parameters + * Define widget params * * @return void */ @@ -59,18 +66,18 @@ protected function defineWidgetParams() parent::defineWidgetParams(); $this->widgetParams += array( - self::CLASS_NAME => new \XLite\Model\WidgetParam\String('className', null), - self::CLASS_ID => new \XLite\Model\WidgetParam\String('classId', null), + self::PARAM_LIST_CLASS => new \XLite\Model\WidgetParam\String('List class', ''), ); } /** - * getDefaultTemplate() + * Get list class * * @return string */ - protected function getDefaultTemplate() + protected function getListClass() { - return 'product_classes/list/main_input.tpl'; + return $this->getParam(self::PARAM_LIST_CLASS); } + } diff --git a/src/classes/XLite/View/FormField/Select/AttributeGroups.php b/src/classes/XLite/View/FormField/Select/AttributeGroups.php new file mode 100644 index 0000000000..fcb6d9716e --- /dev/null +++ b/src/classes/XLite/View/FormField/Select/AttributeGroups.php @@ -0,0 +1,63 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\FormField\Select; + +/** + * Attribute groups selector + * + */ +class AttributeGroups extends \XLite\View\FormField\Select\Regular +{ + /** + * Get attribute groups list + * + * @return array + */ + protected function getAttributeGroupsList() + { + $list = array(); + $cnd = new \XLite\Core\CommonCell; + if ($this->getProductClass()) { + $cnd->productClass = $this->getProductClass(); + } + + foreach (\XLite\Core\Database::getRepo('\XLite\Model\AttributeGroup')->search($cnd) as $e) { + $list[$e->getId()] = $e->getName(); + } + + return $list; + } + + /** + * Get default options + * + * @return array + */ + protected function getDefaultOptions() + { + return array('0' => 'No group') + $this->getAttributeGroupsList(); + } +} diff --git a/src/classes/XLite/View/FormField/Select/AttributeTypes.php b/src/classes/XLite/View/FormField/Select/AttributeTypes.php new file mode 100644 index 0000000000..806746f36b --- /dev/null +++ b/src/classes/XLite/View/FormField/Select/AttributeTypes.php @@ -0,0 +1,59 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\FormField\Select; + +/** + * Attribute types selector + * + */ +class AttributeTypes extends \XLite\View\FormField\Select\Regular +{ + /** + * Get default options + * + * @return array + */ + protected function getDefaultOptions() + { + return \XLite\Model\Attribute::getTypes(); + } + + /** + * Set common attributes + * + * @param array $attrs Field attributes to prepare + * + * @return array + */ + protected function setCommonAttributes(array $attrs) + { + $attrs = parent::setCommonAttributes($attrs); + + $attrs['data-value'] = $this->getValue(); + + return $attrs; + } +} diff --git a/src/classes/XLite/View/FormField/Select/AttributeValues.php b/src/classes/XLite/View/FormField/Select/AttributeValues.php new file mode 100644 index 0000000000..15aa469fe8 --- /dev/null +++ b/src/classes/XLite/View/FormField/Select/AttributeValues.php @@ -0,0 +1,92 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\FormField\Select; + +/** + * Attribute groups selector + * + */ +class AttributeValues extends \XLite\View\FormField\Select\Regular +{ + /** + * Common params + */ + const PARAM_ATTRIBUTE = 'attribute'; + + /** + * Get attribute groups list + * + * @return array + */ + protected function getAttributeValuesList() + { + $list = array(); + $cnd = new \XLite\Core\CommonCell; + $cnd->attribute = $this->getParam(self::PARAM_ATTRIBUTE); + + foreach (\XLite\Core\Database::getRepo('\XLite\Model\AttributeOption')->search($cnd) as $e) { + $list[$e->getId()] = $e->getName(); + } + + return $list; + } + + /** + * Define widget params + * + * @return void + */ + protected function defineWidgetParams() + { + parent::defineWidgetParams(); + + $this->widgetParams += array( + self::PARAM_ATTRIBUTE => new \XLite\Model\WidgetParam\Object( + 'Attribute', null, false, 'XLite\Model\Attribute' + ), + ); + } + + /** + * Get options + * + * @return array + */ + protected function getOptions() + { + return $this->getAttributeValuesList(); + } + + /** + * Get default options + * + * @return array + */ + protected function getDefaultOptions() + { + return array(); + } +} diff --git a/src/classes/XLite/View/FormField/Select/Classes.php b/src/classes/XLite/View/FormField/Select/Classes.php index 230ac48ac2..054276c1a5 100644 --- a/src/classes/XLite/View/FormField/Select/Classes.php +++ b/src/classes/XLite/View/FormField/Select/Classes.php @@ -78,7 +78,7 @@ protected function getFieldTemplate() protected function getDefaultOptions() { $list = array(); - foreach (\XLite\Core\Database::getRepo('\XLite\Model\ProductClass')->findAll() as $class) { + foreach (\XLite\Core\Database::getRepo('\XLite\Model\ProductClass')->search() as $class) { $list[$class->getId()] = $class->getName(); } diff --git a/src/classes/XLite/View/FormField/Select/Decimals.php b/src/classes/XLite/View/FormField/Select/Decimals.php new file mode 100644 index 0000000000..98f27cee37 --- /dev/null +++ b/src/classes/XLite/View/FormField/Select/Decimals.php @@ -0,0 +1,49 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\FormField\Select; + +/** + * Decimals selector + * + */ +class Decimals extends \XLite\View\FormField\Select\Regular +{ + /** + * Get default options + * + * @return array + */ + protected function getDefaultOptions() + { + return array( + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => 4 + ); + } +} diff --git a/src/classes/XLite/View/FormField/Select/ProductClasses.php b/src/classes/XLite/View/FormField/Select/ProductClasses.php index e8e42e9fda..2ccf3221c9 100644 --- a/src/classes/XLite/View/FormField/Select/ProductClasses.php +++ b/src/classes/XLite/View/FormField/Select/ProductClasses.php @@ -39,7 +39,7 @@ class ProductClasses extends \XLite\View\FormField\Select\Multiple protected function getProductClassesList() { $list = array(); - foreach (\XLite\Core\Database::getRepo('\XLite\Model\ProductClass')->findAll() as $e) { + foreach (\XLite\Core\Database::getRepo('\XLite\Model\ProductClass')->search() as $e) { $list[$e->getId()] = $e->getName(); } diff --git a/src/classes/XLite/View/ItemsList/Model/AModel.php b/src/classes/XLite/View/ItemsList/Model/AModel.php index f969edd54f..970a77327e 100644 --- a/src/classes/XLite/View/ItemsList/Model/AModel.php +++ b/src/classes/XLite/View/ItemsList/Model/AModel.php @@ -494,6 +494,9 @@ protected function update() foreach ($this->getPageData() as $entity) { $entity->getRepository()->update($entity, array(), false); + if ($this->isDefault()) { + $entity->setDefaultValue(isset($this->requestData['defaultValue']) && $this->requestData['defaultValue'] == $entity->getId()); + } } return $count; @@ -872,6 +875,16 @@ protected function isRemoved() return false; } + /** + * Mark list iten as default + * + * @return boolean + */ + protected function isDefault() + { + return false; + } + /** * Mark list as selectable * diff --git a/src/classes/XLite/View/ItemsList/Model/Attribute.php b/src/classes/XLite/View/ItemsList/Model/Attribute.php new file mode 100644 index 0000000000..d685a95a1b --- /dev/null +++ b/src/classes/XLite/View/ItemsList/Model/Attribute.php @@ -0,0 +1,251 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\ItemsList\Model; + +/** + * Attributes items list + * + */ +class Attribute extends \XLite\View\ItemsList\Model\Table +{ + /** + * Widget param names + */ + + const PARAM_GROUP = 'group'; + + /** + * Define columns structure + * + * @return array + */ + protected function defineColumns() + { + return array( + 'name' => array( + static::COLUMN_NAME => $this->getAttributeGroup() + ? $this->getAttributeGroup()->getName() + : \XLite\Core\Translation::lbl('No group'), + static::COLUMN_CLASS => 'XLite\View\FormField\Inline\Input\Text', + static::COLUMN_PARAMS => array('required' => true), + ), + 'type' => array( + static::COLUMN_NAME => $this->getAttributeGroup() + ? \XLite\Core\Translation::getInstance()->lbl( + '{{count}} attributes in group', + array( + 'count' => $this->getAttributeGroup()->getAttributesCount() + ) + ) + : null, + static::COLUMN_TEMPLATE => 'attributes/parts/type.tpl', + ), + ); + } + + /** + * Define repository name + * + * @return string + */ + protected function defineRepositoryName() + { + return 'XLite\Model\Attribute'; + } + + /** + * Get create entity URL + * + * @return string + */ + protected function getCreateURL() + { + return \XLite\Core\Converter::buildUrl('attribute'); + } + + /** + * Get create button label + * + * @return string + */ + protected function getCreateButtonLabel() + { + return 'New attribute'; + } + + /** + * Define widget params + * + * @return void + */ + protected function defineWidgetParams() + { + parent::defineWidgetParams(); + + $this->widgetParams += array( + self::PARAM_GROUP => new \XLite\Model\WidgetParam\Object( + 'Group', null, false, '\XLite\Model\AttributeGroup' + ), + ); + } + + /** + * Get attribute group + * + * @return \XLite\Model\AttributeGroup + */ + protected function getAttributeGroup() + { + return $this->getParam(static::PARAM_GROUP); + } + + // {{{ Behaviors + + /** + * Mark list as removable + * + * @return boolean + */ + protected function isRemoved() + { + return true; + } + + /** + * Mark list as sortable + * + * @return integer + */ + protected function getSortableType() + { + return static::SORT_TYPE_MOVE; + } + + /** + * Check if there are any results to display in list + * + * @return void + */ + protected function hasResults() + { + return true; + } + + /** + * Check if widget is visible + * + * @return boolean + */ + protected function isVisible() + { + return $this->getAttributeGroup() + || 0 < $this->getItemsCount(); + } + + // }}} + + /** + * Get container class + * + * @return string + */ + protected function getContainerClass() + { + $class = parent::getContainerClass() . ' attributes'; + + if ($this->getAttributeGroup()) { + $class = parent::getContainerClass() + . ' group'; + } + + return $class; + } + + /** + * Get panel class + * + * @return \XLite\View\Base\FormStickyPanel + */ + protected function getPanelClass() + { + $groups = $this->getAttributeGroups(); + + return ( + $this->getProductClass()->getAttributesCount() + && ( + !$groups->count() + || ( + $this->getAttributeGroup() + && $groups->last()->getId() == $this->getAttributeGroup()->getId() + ) + ) + ) + ? 'XLite\View\StickyPanel\ItemsList\Attribute' + : null; + } + + + // {{{ Search + + /** + * Return search parameters. + * + * @return array + */ + static public function getSearchParams() + { + return array(); + } + + /** + * Return params list to use for search + * TODO refactor + * + * @return \XLite\Core\CommonCell + */ + protected function getSearchCondition() + { + $result = parent::getSearchCondition(); + + foreach (static::getSearchParams() as $modelParam => $requestParam) { + $paramValue = $this->getParam($requestParam); + + if ('' !== $paramValue && 0 !== $paramValue) { + $result->$modelParam = $paramValue; + } + } + + $result->productClass = $this->getProductClass(); + if (\XLite\Core\Request::getInstance()->isGet()) { + $result->attributeGroup = $this->getAttributeGroup(); + } + + return $result; + } + + // }}} + +} diff --git a/src/classes/XLite/View/ItemsList/Model/AttributeGroup.php b/src/classes/XLite/View/ItemsList/Model/AttributeGroup.php new file mode 100644 index 0000000000..b4ac05e786 --- /dev/null +++ b/src/classes/XLite/View/ItemsList/Model/AttributeGroup.php @@ -0,0 +1,199 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\ItemsList\Model; + +/** + * Attribute groups items list + * + */ +class AttributeGroup extends \XLite\View\ItemsList\Model\Table +{ + /** + * Get a list of CSS files required to display the widget properly + * + * @return array + */ + public function getCSSFiles() + { + $list = parent::getCSSFiles(); + + $list[] = 'attribute_groups/style.css'; + + return $list; + } + + /** + * Define columns structure + * + * @return array + */ + protected function defineColumns() + { + return array( + 'name' => array( + static::COLUMN_CLASS => 'XLite\View\FormField\Inline\Input\Text', + static::COLUMN_MAIN => true, + static::COLUMN_PARAMS => array('required' => true), + ), + ); + } + + /** + * Define repository name + * + * @return string + */ + protected function defineRepositoryName() + { + return 'XLite\Model\AttributeGroup'; + } + + /** + * Get create entity URL + * + * @return string + */ + protected function getCreateURL() + { + return \XLite\Core\Converter::buildUrl('attribute_group'); + } + + /** + * Get create button label + * + * @return string + */ + protected function getCreateButtonLabel() + { + return 'New group'; + } + + /** + * Inline creation mechanism position + * + * @return integer + */ + protected function isInlineCreation() + { + return static::CREATE_INLINE_TOP; + } + + // {{{ Behaviors + + /** + * Mark list as removable + * + * @return boolean + */ + protected function isRemoved() + { + return true; + } + + /** + * Mark list as sortable + * + * @return integer + */ + protected function getSortableType() + { + return static::SORT_TYPE_MOVE; + } + + // }}} + + /** + * Get container class + * + * @return string + */ + protected function getContainerClass() + { + return parent::getContainerClass() . ' attribute_groups'; + } + + /** + * Get panel class + * + * @return \XLite\View\Base\FormStickyPanel + */ + protected function getPanelClass() + { + return null; + } + + /** + * Create entity + * + * @return \XLite\Model\AEntity + */ + protected function createEntity() + { + $entity = parent::createEntity(); + + $entity->setProductClass($this->getProductClass()); + + return $entity; + } + + // {{{ Search + + /** + * Return search parameters. + * + * @return array + */ + static public function getSearchParams() + { + return array(); + } + + /** + * Return params list to use for search + * TODO refactor + * + * @return \XLite\Core\CommonCell + */ + protected function getSearchCondition() + { + $result = parent::getSearchCondition(); + + foreach (static::getSearchParams() as $modelParam => $requestParam) { + $paramValue = $this->getParam($requestParam); + + if ('' !== $paramValue && 0 !== $paramValue) { + $result->$modelParam = $paramValue; + } + } + + $result->productClass = $this->getProductClass(); + + return $result; + } + + // }}} + +} diff --git a/src/classes/XLite/View/ItemsList/Model/AttributeOption.php b/src/classes/XLite/View/ItemsList/Model/AttributeOption.php new file mode 100644 index 0000000000..8808ca5cf2 --- /dev/null +++ b/src/classes/XLite/View/ItemsList/Model/AttributeOption.php @@ -0,0 +1,199 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\ItemsList\Model; + +/** + * Attribute options items list + * + */ +class AttributeOption extends \XLite\View\ItemsList\Model\Table +{ + /** + * Get a list of CSS files required to display the widget properly + * + * @return array + */ + public function getCSSFiles() + { + $list = parent::getCSSFiles(); + + $list[] = 'attribute_options/style.css'; + + return $list; + } + + /** + * Define columns structure + * + * @return array + */ + protected function defineColumns() + { + return array( + 'name' => array( + static::COLUMN_CLASS => 'XLite\View\FormField\Inline\Input\Text', + static::COLUMN_MAIN => true, + static::COLUMN_PARAMS => array('required' => true), + ), + ); + } + + /** + * Define repository name + * + * @return string + */ + protected function defineRepositoryName() + { + return 'XLite\Model\AttributeOption'; + } + + /** + * Get create entity URL + * + * @return string + */ + protected function getCreateURL() + { + return \XLite\Core\Converter::buildUrl('attribute_option'); + } + + /** + * Get create button label + * + * @return string + */ + protected function getCreateButtonLabel() + { + return 'New value'; + } + + /** + * Inline creation mechanism position + * + * @return integer + */ + protected function isInlineCreation() + { + return static::CREATE_INLINE_BOTTOM; + } + + // {{{ Behaviors + + /** + * Mark list as removable + * + * @return boolean + */ + protected function isRemoved() + { + return true; + } + + /** + * Mark list iten as default + * + * @return boolean + */ + protected function isDefault() + { + return true; + } + + // }}} + + /** + * Get container class + * + * @return string + */ + protected function getContainerClass() + { + return parent::getContainerClass() . ' attribute_options'; + } + + /** + * Get panel class + * + * @return \XLite\View\Base\FormStickyPanel + */ + protected function getPanelClass() + { + return null; + } + + /** + * Create entity + * + * @return \XLite\Model\AEntity + */ + protected function createEntity() + { + $entity = parent::createEntity(); + + $entity->setAttribute($this->getAttribute()); + + return $entity; + } + + // {{{ Search + + /** + * Return search parameters. + * + * @return array + */ + static public function getSearchParams() + { + return array(); + } + + /** + * Return params list to use for search + * TODO refactor + * + * @return \XLite\Core\CommonCell + */ + protected function getSearchCondition() + { + $result = parent::getSearchCondition(); + + foreach (static::getSearchParams() as $modelParam => $requestParam) { + $paramValue = $this->getParam($requestParam); + + if ('' !== $paramValue && 0 !== $paramValue) { + $result->$modelParam = $paramValue; + } + } + + $result->attribute = $this->getAttribute(); + + return $result; + } + + // }}} + +} diff --git a/src/classes/XLite/View/ItemsList/Model/ProductClass.php b/src/classes/XLite/View/ItemsList/Model/ProductClass.php new file mode 100644 index 0000000000..102fbc543c --- /dev/null +++ b/src/classes/XLite/View/ItemsList/Model/ProductClass.php @@ -0,0 +1,187 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\ItemsList\Model; + +/** + * Product classes items list + * + */ +class ProductClass extends \XLite\View\ItemsList\Model\Table +{ + /** + * Get a list of CSS files required to display the widget properly + * + * @return array + */ + public function getCSSFiles() + { + $list = parent::getCSSFiles(); + + $list[] = 'product_classes/style.css'; + + return $list; + } + + /** + * Define columns structure + * + * @return array + */ + protected function defineColumns() + { + return array( + 'name' => array( + static::COLUMN_CLASS => 'XLite\View\FormField\Inline\Input\Text\ProductClass', + static::COLUMN_PARAMS => array('required' => true), + static::COLUMN_MAIN => true, + ), + 'attributes' => array( + static::COLUMN_TEMPLATE => 'product_classes/parts/edit_attributes.tpl', + ), + ); + } + + /** + * Define repository name + * + * @return string + */ + protected function defineRepositoryName() + { + return 'XLite\Model\ProductClass'; + } + + /** + * Get create entity URL + * + * @return string + */ + protected function getCreateURL() + { + return \XLite\Core\Converter::buildUrl('product_class'); + } + + /** + * Get create button label + * + * @return string + */ + protected function getCreateButtonLabel() + { + return 'New product class'; + } + + /** + * Inline creation mechanism position + * + * @return integer + */ + protected function isInlineCreation() + { + return static::CREATE_INLINE_TOP; + } + + + // {{{ Behaviors + + /** + * Mark list as removable + * + * @return boolean + */ + protected function isRemoved() + { + return true; + } + + /** + * Mark list as sortable + * + * @return integer + */ + protected function getSortableType() + { + return static::SORT_TYPE_MOVE; + } + + // }}} + + /** + * Get container class + * + * @return string + */ + protected function getContainerClass() + { + return parent::getContainerClass() . ' product_classes'; + } + + /** + * Get panel class + * + * @return \XLite\View\Base\FormStickyPanel + */ + protected function getPanelClass() + { + return 'XLite\View\StickyPanel\ItemsList\ProductClass'; + } + + + // {{{ Search + + /** + * Return search parameters. + * + * @return array + */ + static public function getSearchParams() + { + return array(); + } + + /** + * Return params list to use for search + * + * @return \XLite\Core\CommonCell + */ + protected function getSearchCondition() + { + $result = parent::getSearchCondition(); + + foreach (static::getSearchParams() as $modelParam => $requestParam) { + $paramValue = $this->getParam($requestParam); + + if ('' !== $paramValue && 0 !== $paramValue) { + $result->$modelParam = $paramValue; + } + } + + return $result; + } + + // }}} + +} diff --git a/src/classes/XLite/View/ItemsList/Model/Table.php b/src/classes/XLite/View/ItemsList/Model/Table.php index ad309227a6..26143cdc75 100644 --- a/src/classes/XLite/View/ItemsList/Model/Table.php +++ b/src/classes/XLite/View/ItemsList/Model/Table.php @@ -607,6 +607,10 @@ protected function getLeftActions() $list[] = 'items_list/model/table/parts/switcher.tpl'; } + if ($this->isDefault()) { + $list[] = 'items_list/model/table/parts/default.tpl'; + } + return $list; } diff --git a/src/classes/XLite/View/Model/Attribute.php b/src/classes/XLite/View/Model/Attribute.php new file mode 100644 index 0000000000..de570cf912 --- /dev/null +++ b/src/classes/XLite/View/Model/Attribute.php @@ -0,0 +1,202 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\Model; + +/** + * Attribute view model + * + */ +class Attribute extends \XLite\View\Model\AModel +{ + /** + * Shema default + * + * @var array + */ + protected $schemaDefault = array( + 'name' => array( + self::SCHEMA_CLASS => 'XLite\View\FormField\Input\Text', + self::SCHEMA_LABEL => 'Attribute', + self::SCHEMA_REQUIRED => true, + ), + 'attribute_group' => array( + self::SCHEMA_CLASS => 'XLite\View\FormField\Select\AttributeGroups', + self::SCHEMA_LABEL => 'Attribute group', + self::SCHEMA_REQUIRED => false, + ), + 'type' => array( + self::SCHEMA_CLASS => 'XLite\View\FormField\Select\AttributeTypes', + self::SCHEMA_LABEL => 'Type', + self::SCHEMA_REQUIRED => false, + ), + ); + + /** + * Return current model ID + * + * @return integer + */ + public function getModelId() + { + return \XLite\Core\Request::getInstance()->id; + } + + /** + * Return fields list by the corresponding schema + * + * @return array + */ + protected function getFormFieldsForSectionDefault() + { + if ($this->getModelObject()->getId()) { + if ($this->getModelObject()->getAttributeValuesCount()) { + $this->schemaDefault['type'][self::SCHEMA_COMMENT] = 'There are products using this attribute!'; + } + + if ( + \XLite\Model\Attribute::TYPE_NUMBER == $this->getModelObject()->getType() + ) { + $this->schemaDefault['decimals'] = array( + self::SCHEMA_CLASS => 'XLite\View\FormField\Select\Decimals', + self::SCHEMA_LABEL => 'Decimals', + self::SCHEMA_REQUIRED => false, + \XLite\View\FormField\AFormField::PARAM_WRAPPER_CLASS => 'edit-decimals', + ); + $this->schemaDefault['unit'] = array( + self::SCHEMA_CLASS => 'XLite\View\FormField\Input\Text', + self::SCHEMA_LABEL => 'Unit', + self::SCHEMA_REQUIRED => false, + self::SCHEMA_COMMENT => '(suffix)', + \XLite\View\FormField\AFormField::PARAM_WRAPPER_CLASS => 'edit-unit', + ); + } + + if ( + \XLite\Model\Attribute::TYPE_NUMBER == $this->getModelObject()->getType() + || \XLite\Model\Attribute::TYPE_CHECKBOX == $this->getModelObject()->getType() + || \XLite\Model\Attribute::TYPE_TEXT == $this->getModelObject()->getType() + ) { + $this->schemaDefault['default_value'] = array( + self::SCHEMA_CLASS => $this->getModelObject()->getWidgetClass(), + self::SCHEMA_LABEL => 'Default value', + self::SCHEMA_REQUIRED => false, + 'rows' => 1, + 'maxHeight' => 100, + ); + } + + if ( + \XLite\Model\Attribute::TYPE_SELECT == $this->getModelObject()->getType() + ) { + $this->schemaDefault['values'] = array( + self::SCHEMA_CLASS => 'XLite\View\FormField\ItemsList', + self::SCHEMA_LABEL => 'Allowed attribute values and default one', + self::SCHEMA_REQUIRED => false, + \XLite\View\FormField\ItemsList::PARAM_LIST_CLASS => 'XLite\View\ItemsList\Model\AttributeOption', + ); + } + } + + return $this->getFieldsBySchema($this->schemaDefault); + } + + /** + * Populate model object properties by the passed data + * + * @param array $data Data to set + * + * @return void + */ + protected function setModelProperties(array $data) + { + $data['attribute_group'] = \XLite\Core\Database::getRepo('XLite\Model\AttributeGroup')->find($data['attribute_group']); + + parent::setModelProperties($data); + + $this->getModelObject()->setProductClass($this->getProductClass()); + } + + /** + * This object will be used if another one is not pased + * + * @return \XLite\Model\Attribute + */ + protected function getDefaultModelObject() + { + $model = $this->getModelId() + ? \XLite\Core\Database::getRepo('XLite\Model\Attribute')->find($this->getModelId()) + : null; + + return $model ?: new \XLite\Model\Attribute; + } + + /** + * Return name of web form widget class + * + * @return string + */ + protected function getFormClass() + { + return '\XLite\View\Form\Model\Attribute'; + } + + /** + * Return list of the "Button" widgets + * + * @return array + */ + protected function getFormButtons() + { + $result = parent::getFormButtons(); + + $label = $this->getModelObject()->getId() ? 'Save changes' : 'New attribute'; + + $result['submit'] = new \XLite\View\Button\Submit( + array( + \XLite\View\Button\AButton::PARAM_LABEL => $label, + \XLite\View\Button\AButton::PARAM_STYLE => 'action', + ) + ); + + return $result; + } + + /** + * Add top message + * + * @return void + */ + protected function addDataSavedTopMessage() + { + if ('create' != $this->currentAction) { + \XLite\Core\TopMessage::addInfo('The attribute has been updated'); + + } else { + \XLite\Core\TopMessage::addInfo('The attribute has been added'); + } + } + +} diff --git a/src/classes/XLite/View/Model/AttributeGroup.php b/src/classes/XLite/View/Model/AttributeGroup.php new file mode 100644 index 0000000000..3449627ffb --- /dev/null +++ b/src/classes/XLite/View/Model/AttributeGroup.php @@ -0,0 +1,122 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\Model; + +/** + * Attribute group view model + * + */ +class AttributeGroup extends \XLite\View\Model\AModel +{ + /** + * Shema default + * + * @var array + */ + protected $schemaDefault = array( + 'position' => array( + self::SCHEMA_CLASS => 'XLite\View\FormField\Input\Text\Integer', + self::SCHEMA_LABEL => 'Position', + self::SCHEMA_REQUIRED => false, + ), + 'name' => array( + self::SCHEMA_CLASS => 'XLite\View\FormField\Input\Text', + self::SCHEMA_LABEL => 'Name', + self::SCHEMA_REQUIRED => false, + ), + ); + + /** + * Return current model ID + * + * @return integer + */ + public function getModelId() + { + return \XLite\Core\Request::getInstance()->id; + } + + /** + * This object will be used if another one is not pased + * + * @return \XLite\Model\AttributeGroup + */ + protected function getDefaultModelObject() + { + $model = $this->getModelId() + ? \XLite\Core\Database::getRepo('XLite\Model\AttributeGroup')->find($this->getModelId()) + : null; + + return $model ?: new \XLite\Model\AttributeGroup; + } + + /** + * Return name of web form widget class + * + * @return string + */ + protected function getFormClass() + { + return '\XLite\View\Form\Model\AttributeGroup'; + } + + /** + * Return list of the "Button" widgets + * + * @return array + */ + protected function getFormButtons() + { + $result = parent::getFormButtons(); + + $label = $this->getModelObject()->getId() ? 'Update' : 'Create'; + + $result['submit'] = new \XLite\View\Button\Submit( + array( + \XLite\View\Button\AButton::PARAM_LABEL => $label, + \XLite\View\Button\AButton::PARAM_STYLE => 'action', + ) + ); + + return $result; + } + + /** + * Add top message + * + * @return void + */ + protected function addDataSavedTopMessage() + { + if ('create' != $this->currentAction) { + \XLite\Core\TopMessage::addInfo('The attribute group has been updated'); + + } else { + \XLite\Core\TopMessage::addInfo('The attribute group has been added'); + } + } + +} \ No newline at end of file diff --git a/src/classes/XLite/View/Model/AttributeOption.php b/src/classes/XLite/View/Model/AttributeOption.php new file mode 100644 index 0000000000..06804f3909 --- /dev/null +++ b/src/classes/XLite/View/Model/AttributeOption.php @@ -0,0 +1,122 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\Model; + +/** + * Attribute option view model + * + */ +class AttributeOption extends \XLite\View\Model\AModel +{ + /** + * Shema default + * + * @var array + */ + protected $schemaDefault = array( + 'default' => array( + self::SCHEMA_CLASS => 'XLite\View\FormField\Input\Checkbox\Enabled', + self::SCHEMA_LABEL => 'Default', + self::SCHEMA_REQUIRED => false, + ), + 'name' => array( + self::SCHEMA_CLASS => 'XLite\View\FormField\Input\Text', + self::SCHEMA_LABEL => 'Name', + self::SCHEMA_REQUIRED => false, + ), + ); + + /** + * Return current model ID + * + * @return integer + */ + public function getModelId() + { + return \XLite\Core\Request::getInstance()->id; + } + + /** + * This object will be used if another one is not pased + * + * @return \XLite\Model\AttributeOption + */ + protected function getDefaultModelObject() + { + $model = $this->getModelId() + ? \XLite\Core\Database::getRepo('XLite\Model\AttributeOption')->find($this->getModelId()) + : null; + + return $model ?: new \XLite\Model\AttributeOption; + } + + /** + * Return name of web form widget class + * + * @return string + */ + protected function getFormClass() + { + return '\XLite\View\Form\Model\AttributeOption'; + } + + /** + * Return list of the "Button" widgets + * + * @return array + */ + protected function getFormButtons() + { + $result = parent::getFormButtons(); + + $label = $this->getModelObject()->getId() ? 'Update' : 'Create'; + + $result['submit'] = new \XLite\View\Button\Submit( + array( + \XLite\View\Button\AButton::PARAM_LABEL => $label, + \XLite\View\Button\AButton::PARAM_STYLE => 'action', + ) + ); + + return $result; + } + + /** + * Add top message + * + * @return void + */ + protected function addDataSavedTopMessage() + { + if ('create' != $this->currentAction) { + \XLite\Core\TopMessage::addInfo('The attribute option has been updated'); + + } else { + \XLite\Core\TopMessage::addInfo('The attribute option has been added'); + } + } + +} \ No newline at end of file diff --git a/src/classes/XLite/View/Model/ProductClass.php b/src/classes/XLite/View/Model/ProductClass.php new file mode 100644 index 0000000000..9c7f902db8 --- /dev/null +++ b/src/classes/XLite/View/Model/ProductClass.php @@ -0,0 +1,117 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\Model; + +/** + * Product class view model + * + */ +class ProductClass extends \XLite\View\Model\AModel +{ + /** + * Shema default + * + * @var array + */ + protected $schemaDefault = array( + 'name' => array( + self::SCHEMA_CLASS => 'XLite\View\FormField\Input\Text', + self::SCHEMA_LABEL => 'Name', + self::SCHEMA_REQUIRED => false, + ), + ); + + /** + * Return current model ID + * + * @return integer + */ + public function getModelId() + { + return \XLite\Core\Request::getInstance()->id; + } + + /** + * This object will be used if another one is not pased + * + * @return \XLite\Model\ProductClass + */ + protected function getDefaultModelObject() + { + $model = $this->getModelId() + ? \XLite\Core\Database::getRepo('XLite\Model\ProductClass')->find($this->getModelId()) + : null; + + return $model ?: new \XLite\Model\ProductClass; + } + + /** + * Return name of web form widget class + * + * @return string + */ + protected function getFormClass() + { + return '\XLite\View\Form\Model\ProductClass'; + } + + /** + * Return list of the "Button" widgets + * + * @return array + */ + protected function getFormButtons() + { + $result = parent::getFormButtons(); + + $label = $this->getModelObject()->getId() ? 'Update' : 'Create'; + + $result['submit'] = new \XLite\View\Button\Submit( + array( + \XLite\View\Button\AButton::PARAM_LABEL => $label, + \XLite\View\Button\AButton::PARAM_STYLE => 'action', + ) + ); + + return $result; + } + + /** + * Add top message + * + * @return void + */ + protected function addDataSavedTopMessage() + { + if ('create' != $this->currentAction) { + \XLite\Core\TopMessage::addInfo('The product class has been updated'); + + } else { + \XLite\Core\TopMessage::addInfo('The product class has been added'); + } + } + +} \ No newline at end of file diff --git a/src/classes/XLite/View/Product/Details/AAttributes.php b/src/classes/XLite/View/Product/Details/AAttributes.php new file mode 100644 index 0000000000..ca2e9b76bf --- /dev/null +++ b/src/classes/XLite/View/Product/Details/AAttributes.php @@ -0,0 +1,106 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\Product\Details; + +/** + * Product attributes + * + */ +abstract class AAttributes extends \XLite\View\AView +{ + /** + * Widget param names + */ + const PARAM_GROUP = 'group'; + + /** + * Get step title + * + * @return string + */ + public function getTitle() + { + return $this->getAttributeGroup() + ? $this->getAttributeGroup()->getName() + : null; + } + + /** + * Check if widget is visible + * + * @return boolean + */ + protected function isVisible() + { + return parent::isVisible() + && $this->getAttributesList(true); + } + + /** + * Define widget params + * + * @return void + */ + protected function defineWidgetParams() + { + parent::defineWidgetParams(); + + $this->widgetParams += array( + self::PARAM_GROUP => new \XLite\Model\WidgetParam\Object( + 'Group', null, false, '\XLite\Model\AttributeGroup' + ), + ); + } + + /** + * Get attribute group + * + * @return \XLite\Model\AttributeGroup + */ + protected function getAttributeGroup() + { + return $this->getParam(static::PARAM_GROUP); + } + + /** + * Get attributes list + * + * @param boolean $countOnly Return items list or only its size OPTIONAL + * + * @return array|integer + */ + protected function getAttributesList($countOnly = false) + { + $cnd = new \XLite\Core\CommonCell; + $cnd->attributeGroup = $this->getAttributeGroup(); + if (!$this->getAttributeGroup()) { + $cnd->product = $this->getProduct(); + } + + return \XLite\Core\Database::getRepo('\XLite\Model\Attribute')->search($cnd, $countOnly); + } + +} diff --git a/src/classes/XLite/View/Product/Details/Admin/Attributes.php b/src/classes/XLite/View/Product/Details/Admin/Attributes.php new file mode 100644 index 0000000000..6eb15297cd --- /dev/null +++ b/src/classes/XLite/View/Product/Details/Admin/Attributes.php @@ -0,0 +1,100 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\Product\Details\Admin; + +/** + * Product attributes + * + */ +class Attributes extends \XLite\View\Product\Details\AAttributes +{ + /** + * Register CSS files + * + * @return array + */ + public function getCSSFiles() + { + $list = parent::getCSSFiles(); + + $list[] = 'product/attributes/style.css'; + + return $list; + } + + /** + * Return widget default template + * + * @return string + */ + protected function getDefaultTemplate() + { + return 'product/attributes/fields.tpl'; + } + + /** + * Get attributes list + * + * @param boolean $countOnly Return items list or only its size OPTIONAL + * + * @return array|integer + */ + protected function getAttributesList($countOnly = false) + { + $cnd = new \XLite\Core\CommonCell; + $cnd->attributeGroup = $this->getAttributeGroup(); + if (!$this->getAttributeGroup()) { + $cnd->product = $this->getProduct(); + } + + $data = parent::getAttributesList($countOnly); + + if ($countOnly) { + $result = $data; + + } else { + $result = array(); + foreach ($data as $attribute) { + $result[] = $this->getWidget( + array( + 'fieldName' => 'attributeValues[' . $attribute->getId() . ']', + 'label' => $attribute->getName(), + 'maxHeight' => 100, + 'rows' => 1, + 'attribute' => $attribute, + 'comment' => \XLite\Model\Attribute::TYPE_NUMBER == $attribute->getType() + ? $attribute->getUnit() + : '', + 'value' => $attribute->getAttributeValue($this->getProduct()) + ), + $attribute->getWidgetClass() + ); + } + } + + return $result; + } +} diff --git a/src/classes/XLite/View/Product/Details/Customer/Attributes.php b/src/classes/XLite/View/Product/Details/Customer/Attributes.php new file mode 100644 index 0000000000..df23766e7e --- /dev/null +++ b/src/classes/XLite/View/Product/Details/Customer/Attributes.php @@ -0,0 +1,89 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\Product\Details\Customer; + +/** + * Product attributes + * + */ +class Attributes extends \XLite\View\Product\Details\AAttributes +{ + /** + * Attributes + * + * @var array + */ + protected $attributes; + + /** + * Register CSS files + * + * @return array + */ + public function getAttrList() + { + if (is_null($this->attributes)) { + $this->attributes = array(); + foreach ($this->getAttributesList() as $a) { + $value = $a->getAttributeValue($this->getProduct(), true); + $class = strtolower($a->getTypes($a->getType())); + if (\XLite\Model\Attribute::TYPE_CHECKBOX == $a->getType()) { + $class .= ' ' . (static::t('yes') == $value ? 'checked' : 'no-checked'); + } + if ($value) { + $this->attributes[] = array( + 'name' => $a->getName(), + 'value' => $value, + 'class' => $class + ); + } + } + } + + return $this->attributes; + } + + /** + * Return widget default template + * + * @return string + */ + protected function getDefaultTemplate() + { + return 'product/details/parts/attribute.tpl'; + } + + /** + * Check if widget is visible + * + * @return boolean + */ + protected function isVisible() + { + return parent::isVisible() + && $this->getAttrList(); + } +} diff --git a/src/classes/XLite/View/Product/Details/Customer/Page/APage.php b/src/classes/XLite/View/Product/Details/Customer/Page/APage.php index acc1458a85..8d34cf76a8 100644 --- a/src/classes/XLite/View/Product/Details/Customer/Page/APage.php +++ b/src/classes/XLite/View/Product/Details/Customer/Page/APage.php @@ -135,6 +135,15 @@ protected function defineTabs() ); } + if ( + $this->getProduct()->getAttrSepTab() + && $this->getProduct()->getClasses() + ) { + $list['Specification'] = array( + 'list' => 'product.details.page.tab.attributes' + ); + } + return $list; } diff --git a/src/classes/XLite/View/ProductClass.php b/src/classes/XLite/View/ProductClass.php new file mode 100644 index 0000000000..299c2abe42 --- /dev/null +++ b/src/classes/XLite/View/ProductClass.php @@ -0,0 +1,56 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View; + +/** + * Product class page view + * + * + * @ListChild (list="admin.center", zone="admin") + */ +class ProductClass extends \XLite\View\AView +{ + /** + * Return list of allowed targets + * + * @return array + */ + public static function getAllowedTargets() + { + return array_merge(parent::getAllowedTargets(), array('product_class')); + } + + /** + * Return widget default template + * + * @return string + */ + protected function getDefaultTemplate() + { + return 'product_class/body.tpl'; + } + +} diff --git a/src/classes/XLite/View/ProductClasses.php b/src/classes/XLite/View/ProductClasses.php new file mode 100644 index 0000000000..536b92a2d7 --- /dev/null +++ b/src/classes/XLite/View/ProductClasses.php @@ -0,0 +1,66 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View; + +/** + * Product classes page view + * + * + * @ListChild (list="admin.center", zone="admin") + */ +class ProductClasses extends \XLite\View\AView +{ + /** + * Return list of allowed targets + * + * @return array + */ + public static function getAllowedTargets() + { + return array_merge(parent::getAllowedTargets(), array('product_classes')); + } + + /** + * Return widget default template + * + * @return string + */ + protected function getDefaultTemplate() + { + return 'product_classes/body.tpl'; + } + + /** + * Check - search box is visible or not + * + * @return boolean + */ + protected function isSearchVisible() + { + return 0 < \XLite\Core\Database::getRepo('XLite\Model\ProductClass')->count(); + } + +} \ No newline at end of file diff --git a/src/classes/XLite/View/StickyPanel/ItemsList/Attribute.php b/src/classes/XLite/View/StickyPanel/ItemsList/Attribute.php new file mode 100644 index 0000000000..5621f22647 --- /dev/null +++ b/src/classes/XLite/View/StickyPanel/ItemsList/Attribute.php @@ -0,0 +1,34 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\StickyPanel\ItemsList; + +/** + * Attributes items list's sticky panel + * + */ +class Attribute extends \XLite\View\StickyPanel\ItemsListForm +{ +} \ No newline at end of file diff --git a/src/classes/XLite/View/StickyPanel/ItemsList/ProductClass.php b/src/classes/XLite/View/StickyPanel/ItemsList/ProductClass.php new file mode 100644 index 0000000000..2a5c19787f --- /dev/null +++ b/src/classes/XLite/View/StickyPanel/ItemsList/ProductClass.php @@ -0,0 +1,34 @@ + + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +namespace XLite\View\StickyPanel\ItemsList; + +/** + * Product classes items list's sticky panel + * + */ +class ProductClass extends \XLite\View\StickyPanel\ItemsListForm +{ +} \ No newline at end of file diff --git a/src/classes/XLite/View/TopMenu.php b/src/classes/XLite/View/TopMenu.php index 3f0acc033b..74fac00e17 100644 --- a/src/classes/XLite/View/TopMenu.php +++ b/src/classes/XLite/View/TopMenu.php @@ -65,6 +65,10 @@ class TopMenu extends \XLite\View\AView 'db_backup' => array( 'db_restore', ), + 'product_classes' => array( + 'product_class', + 'attributes', + ), ); diff --git a/src/skins/admin/en/attribute/body.tpl b/src/skins/admin/en/attribute/body.tpl new file mode 100644 index 0000000000..31de80cd6f --- /dev/null +++ b/src/skins/admin/en/attribute/body.tpl @@ -0,0 +1,11 @@ +{* vim: set ts=2 sw=2 sts=2 et: *} + +{** + * Attribute page template + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + *} + diff --git a/src/skins/admin/en/attribute/footer.tpl b/src/skins/admin/en/attribute/footer.tpl new file mode 100644 index 0000000000..6507546d56 --- /dev/null +++ b/src/skins/admin/en/attribute/footer.tpl @@ -0,0 +1,14 @@ +{* vim: set ts=2 sw=2 sts=2 et: *} + +{** + * Attribute footer + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + * + * @ListChild (list="crud.attribute.footer", zone="admin", weight="100") + *} + +
{t(#Editing attribute groups on this page won't affect other product classes which use these groups. Removing a group doesn't delete attributes from the group, but makes them show up among other attributes having no associated groups.#)}
diff --git a/src/skins/admin/en/attribute/select.tpl b/src/skins/admin/en/attribute/select.tpl new file mode 100644 index 0000000000..d862b5e04b --- /dev/null +++ b/src/skins/admin/en/attribute/select.tpl @@ -0,0 +1 @@ +sdfsdfsdfds diff --git a/src/skins/admin/en/attribute/style.css b/src/skins/admin/en/attribute/style.css new file mode 100644 index 0000000000..c0837929f8 --- /dev/null +++ b/src/skins/admin/en/attribute/style.css @@ -0,0 +1,10 @@ +/* vim: set ts=2 sw=2 sts=2 et: */ + +/** + * Attribute view model styles + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ diff --git a/src/skins/admin/en/attribute_group/body.tpl b/src/skins/admin/en/attribute_group/body.tpl new file mode 100644 index 0000000000..df399b6405 --- /dev/null +++ b/src/skins/admin/en/attribute_group/body.tpl @@ -0,0 +1,11 @@ +{* vim: set ts=2 sw=2 sts=2 et: *} + +{** + * Attribute group page template + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + *} + \ No newline at end of file diff --git a/src/skins/admin/en/attribute_group/style.css b/src/skins/admin/en/attribute_group/style.css new file mode 100644 index 0000000000..d52a4746b2 --- /dev/null +++ b/src/skins/admin/en/attribute_group/style.css @@ -0,0 +1,10 @@ +/* vim: set ts=2 sw=2 sts=2 et: */ + +/** + * Attribute group view model styles + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ diff --git a/src/skins/admin/en/attribute_groups/body.tpl b/src/skins/admin/en/attribute_groups/body.tpl new file mode 100644 index 0000000000..239c7e60d7 --- /dev/null +++ b/src/skins/admin/en/attribute_groups/body.tpl @@ -0,0 +1,12 @@ +{* vim: set ts=2 sw=2 sts=2 et: *} + +{** + * Attribute groups page template + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + *} + + diff --git a/src/skins/admin/en/attribute_groups/list.tpl b/src/skins/admin/en/attribute_groups/list.tpl new file mode 100644 index 0000000000..f42c2db7af --- /dev/null +++ b/src/skins/admin/en/attribute_groups/list.tpl @@ -0,0 +1,18 @@ +{* vim: set ts=2 sw=2 sts=2 et: *} + +{** + * Attribute groups list table template + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + *} + + + +
+ +
+ +
{t(#Editing attribute groups on this page won't affect other product classes which use these groups. Removing a group doesn't delete attributes from the group, but makes them show up among other attributes having no associated groups.#)}
diff --git a/src/skins/admin/en/attribute_groups/style.css b/src/skins/admin/en/attribute_groups/style.css new file mode 100644 index 0000000000..880d5660fa --- /dev/null +++ b/src/skins/admin/en/attribute_groups/style.css @@ -0,0 +1,10 @@ +/* vim: set ts=2 sw=2 sts=2 et: */ + +/** + * Attribute groups list styles + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ diff --git a/src/skins/admin/en/attribute_option/body.tpl b/src/skins/admin/en/attribute_option/body.tpl new file mode 100644 index 0000000000..8b1aa553f4 --- /dev/null +++ b/src/skins/admin/en/attribute_option/body.tpl @@ -0,0 +1,11 @@ +{* vim: set ts=2 sw=2 sts=2 et: *} + +{** + * Attribute option page template + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + *} + \ No newline at end of file diff --git a/src/skins/admin/en/attribute_option/style.css b/src/skins/admin/en/attribute_option/style.css new file mode 100644 index 0000000000..ac508f99cd --- /dev/null +++ b/src/skins/admin/en/attribute_option/style.css @@ -0,0 +1,10 @@ +/* vim: set ts=2 sw=2 sts=2 et: */ + +/** + * Attribute option view model styles + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ diff --git a/src/skins/admin/en/attribute_options/body.tpl b/src/skins/admin/en/attribute_options/body.tpl new file mode 100644 index 0000000000..c5d0cf00b1 --- /dev/null +++ b/src/skins/admin/en/attribute_options/body.tpl @@ -0,0 +1,12 @@ +{* vim: set ts=2 sw=2 sts=2 et: *} + +{** + * Attribute options page template + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + *} + + \ No newline at end of file diff --git a/src/skins/admin/en/attribute_options/list.tpl b/src/skins/admin/en/attribute_options/list.tpl new file mode 100644 index 0000000000..35e1d099f8 --- /dev/null +++ b/src/skins/admin/en/attribute_options/list.tpl @@ -0,0 +1,14 @@ +{* vim: set ts=2 sw=2 sts=2 et: *} + +{** + * Attribute options list table template + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + *} + + + + \ No newline at end of file diff --git a/src/skins/admin/en/attribute_options/style.css b/src/skins/admin/en/attribute_options/style.css new file mode 100644 index 0000000000..3e84d34c29 --- /dev/null +++ b/src/skins/admin/en/attribute_options/style.css @@ -0,0 +1,10 @@ +/* vim: set ts=2 sw=2 sts=2 et: */ + +/** + * Attribute options list styles + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ diff --git a/src/skins/admin/en/attributes/body.tpl b/src/skins/admin/en/attributes/body.tpl new file mode 100644 index 0000000000..feb33ccfe8 --- /dev/null +++ b/src/skins/admin/en/attributes/body.tpl @@ -0,0 +1,18 @@ +{* vim: set ts=2 sw=2 sts=2 et: *} + +{** + * Attributes page template + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + *} + + + + +
+
+ + diff --git a/src/skins/admin/en/attributes/list.tpl b/src/skins/admin/en/attributes/list.tpl new file mode 100644 index 0000000000..1505da9488 --- /dev/null +++ b/src/skins/admin/en/attributes/list.tpl @@ -0,0 +1,17 @@ +{* vim: set ts=2 sw=2 sts=2 et: *} + +{** + * Attributes list table template + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + *} + + + +{foreach:getAttributeGroups(),group} + +{end:} + diff --git a/src/skins/admin/en/attributes/parts/type.tpl b/src/skins/admin/en/attributes/parts/type.tpl new file mode 100644 index 0000000000..3cc1c52f95 --- /dev/null +++ b/src/skins/admin/en/attributes/parts/type.tpl @@ -0,0 +1,13 @@ +{* vim: set ts=2 sw=2 sts=2 et: *} + +{** + * Type + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + *} + + +{t(entity.getTypes(entity.getType()))} diff --git a/src/skins/admin/en/attributes/script.js b/src/skins/admin/en/attributes/script.js new file mode 100644 index 0000000000..02e5be99e8 --- /dev/null +++ b/src/skins/admin/en/attributes/script.js @@ -0,0 +1,58 @@ +/* vim: set ts=2 sw=2 sts=2 et: */ + +/** + * Attributes + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +var ppr = popup.postprocessRequest; +popup.postprocessRequest = function(XMLHttpRequest, textStatus, data, isValid) { + ppr.call(this, XMLHttpRequest, textStatus, data, isValid); + TableItemsListQueue(); + + jQuery('.select-attributetypes select').change( + function () { + if (jQuery(this).data('value') == jQuery(this).val()) { + jQuery('.select-attributetypes .form-field-comment').hide(); + } else { + jQuery('.select-attributetypes .form-field-comment').show(); + } + } + ); +} + +var pprc = popup.postprocessRequestCallback; +popup.postprocessRequestCallback() = function() +{ + pprc.postprocessRequestCallback(); + popup.close(); +} + +function popup_attribute_groups(product_class_id) { + return !popup.load( + URLHandler.buildURL({ + target: 'attribute_groups', + product_class_id: product_class_id, + widget: 'XLite\\View\\AttributeGroups' + }) + ); +} + +function popup_attribute(product_class_id, id) { + return !popup.load( + URLHandler.buildURL({ + target: 'attribute', + product_class_id: product_class_id, + id: id, + widget: 'XLite\\View\\Attribute' + }), + null, + function () { + self.location.reload(); + } + ); +} diff --git a/src/skins/admin/en/attributes/style.css b/src/skins/admin/en/attributes/style.css new file mode 100644 index 0000000000..93b04f8cf0 --- /dev/null +++ b/src/skins/admin/en/attributes/style.css @@ -0,0 +1,276 @@ +/* vim: set ts=2 sw=2 sts=2 et: */ + +/** + * Attributes list styles + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +.items-list-table table.list th.name { + width: 500px; + color: #456583; + font-size: 16px; +} + +.items-list-table table.list th.type { + width: 200px; + text-align: right; +} + +.items-list-table table.list td.type { + text-align: right; + color: #8f8f8f; +} + +.items-list-table table.list .edit-mark td.type { + color: #333333; +} + +.items-list-table table.list th.actions.left { + width: 30px; +} + +.items-list-table table.list th.actions.right { + width: 25px; +} + +.items-list-table.group { + margin-top: 20px; +} + +button.new-attribute span { + background: url("../images/icon_list.png") no-repeat scroll left top transparent; + padding: 2px 0 2px 25px; +} + +button.manage-groups span { + background: url("../images/icon_folder.png") no-repeat scroll left top transparent; + padding: 2px 0 2px 25px; +} + +div.group table.list th.actions.left { + background: url("../images/icon_folder.png") no-repeat scroll center center transparent; +} + +/* + * Popup box + */ + +.blockMsg +{ + background: transparent none; + margin: 0px; + padding: 0px; + z-index: 1001; + position: absolute; + top: 30%; +} + +.blockMsg .close-link +{ + display: block; + position: absolute; + background: transparent url(../../../common/ui/images/icon_window_close.png) no-repeat 10px 10px; + top: 0px; + right: 0px; + width: 41px; + height: 41px; + outline: none; + -moz-border-radius-bottomright: 11px; + -moz-border-radius-topright: 11px; + -webkit-border-bottom-right-radius: 11px; + -webkit-border-top-right-radius: 11px; + border-bottom-right-radius: 11px; + border-top-right-radius: 11px; +} + +.blockMsg .block-container +{ + margin-right: 31px; + border-style: none; + -moz-border-radius: 11px; + -webkit-border-radius: 11px; + border-radius: 11px; + padding: 10px; +} + +.blockMsg .block-subcontainer +{ + padding: 40px; + padding-top: 30px; + background: white; + overflow: auto; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; +} + +.block-wait +{ + text-align: left; + vertical-align: middle; + font-weight: bold; + min-width: 200px; + border: 1px solid #cadce8; + background: #fff none; +} + +.block-wait div +{ + background: transparent url(../images/progress.gif) repeat-x left top; + height: 11px; + margin: 10px; +} + +.mini-block-wait div +{ + margin: 0px; +} + +/* Background overlay */ + +.blockOverlay +{ + background: transparent url(../../../common/ui/images/popup_overlay.png) repeat top left !important; +} + +.blockMsg .close-link, +.blockMsg .block-container +{ + background-color: #7a7a7a; +} + +/* Common popup styles */ + +.blockMsg h2 +{ + margin-top: 0px; + font-size: 32px; +} + +.blockMsg h3 +{ + font-size: 24px; +} + +.blockMsg .model-properties ul.table { + min-width: 450px; +} + +.edit-attribute { + background: url("../images/tri_right_button.png") no-repeat scroll right top transparent; + padding: 0 11px 0 0; + border: none; + border-radius: 0; + display: none; + margin: 0 5px 0 0; +} +.edit-mark .edit-attribute { + display: inline; +} +.edit-attribute span { + background-color: #eff9fe; + border: 1px solid #CADCE8; + border-bottom-left-radius: 3px; + border-right: 0 none; + border-top-left-radius: 3px; + padding: 5px 0 5px 10px; + background-color: #EFF8FE; + color: #154E9C; + line-height: 24px; +} + +.ajax-container-loadable .model-properties ul.table div.table-label label { + font-size: 16px; + color: #456583; + width: auto; +} + +.ajax-container-loadable .model-properties div.table-value { + width: auto; + margin-left: 10px; + float: left; +} + +.ajax-container-loadable div.button.submit { + text-align: center; +} + +.ajax-container-loadable div.table-value select { + width: auto; + max-width: 200px; + float: left; +} + +.ajax-container-loadable .select-attributetypes div.table-value .form-field-comment { + background: url("../images/icon_warning_round.png") no-repeat scroll 20px center transparent; + padding: 1px 0 0 50px; + color: #456583; + float: left; + display: none; +} + +.ajax-container-loadable div.table-value .form-field-comment { + float: right; + font-size: 12px; +} + +.ajax-container-loadable .star { + display: none; +} + +.ajax-container-loadable li.edit-unit { + display: inline; + position: absolute; + margin-left: 10px; +} + +.ajax-container-loadable li.edit-unit div.table-value input { + width: 50px; + margin-right: 5px; +} + +.ajax-container-loadable .model-properties ul.table li { + margin-bottom: 10px; +} + +.ajax-container-loadable li.edit-decimals { + float: left; +} + +.ajax-container-loadable div.note { + color: #456583; + text-align: center; + width: 440px; + margin-top: 10px; +} + +.ajax-container-loadable .model-form-buttons { + padding: 0px; +} + +.ajax-container-loadable { + width: 500px; +} + +.ajax-container-loadable .list-footer { + margin: 0; + padding: 0; +} + +.ajax-container-loadable .itemslist button { + border: 0; + background: none; +} + +.ajax-container-loadable .itemslist button span { + text-decoration: underline; + font-size: 14px; +} + +.ajax-container-loadable .main .view { + position: relative; +} diff --git a/src/skins/admin/en/css/style.css b/src/skins/admin/en/css/style.css index 6f455ab61e..db702c5dd6 100644 --- a/src/skins/admin/en/css/style.css +++ b/src/skins/admin/en/css/style.css @@ -1645,6 +1645,10 @@ div.table-label { width: 80px; } +.model-properties ul.table li.itemslist div.table-value { + width: 100%; +} + div.star { float: right; width: 10px; diff --git a/src/skins/admin/en/form_field/inline/input/text/product-class.js b/src/skins/admin/en/form_field/inline/input/text/product-class.js new file mode 100644 index 0000000000..870502eb28 --- /dev/null +++ b/src/skins/admin/en/form_field/inline/input/text/product-class.js @@ -0,0 +1,19 @@ +/* vim: set ts=2 sw=2 sts=2 et: */ + +/** + * Product class field controller + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +CommonForm.elementControllers.push( + { + pattern: '.inline-field.inline-product-class', + handler: function () { + this.viewValuePattern = '.view .value'; + } + } +); diff --git a/src/skins/admin/en/form_field/inline/input/text/product-class.tpl b/src/skins/admin/en/form_field/inline/input/text/product-class.tpl new file mode 100644 index 0000000000..5e49ab35d0 --- /dev/null +++ b/src/skins/admin/en/form_field/inline/input/text/product-class.tpl @@ -0,0 +1,13 @@ +{* vim: set ts=2 sw=2 sts=2 et: *} + +{** + * Product class inline view + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + *} + +{getViewValue(singleField):h} +({entity.getProductsCount()} {t(#products#)}) diff --git a/src/skins/admin/en/form_field/input/text/autocomplete.js b/src/skins/admin/en/form_field/input/text/autocomplete.js index 84ebfa96b6..fce8bf8501 100644 --- a/src/skins/admin/en/form_field/input/text/autocomplete.js +++ b/src/skins/admin/en/form_field/input/text/autocomplete.js @@ -18,7 +18,7 @@ CommonForm.elementControllers.push( this.autocompleteSource = function(request, response) { core.get( - jQuery(this).data('source-url').replace('%term%', request.term), + unescape(jQuery(this).data('source-url')).replace('%term%', request.term), null, {}, { diff --git a/src/skins/admin/en/form_field/input/text/combobox.css b/src/skins/admin/en/form_field/input/text/combobox.css new file mode 100644 index 0000000000..0b8e97d25c --- /dev/null +++ b/src/skins/admin/en/form_field/input/text/combobox.css @@ -0,0 +1,27 @@ +/* vim: set ts=2 sw=2 sts=2 et: */ + +/** + * Combobox styles + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +input.combobox { + float: left; + padding-right: 21px; +} + +div.combobox-select { + background: transparent url(../images/arrows-select.png) center center no-repeat; + width: 21px; + height: 21px; + float: left; + display: inline; + position: relative; + top: 1px; + right: 22px; + cursor: pointer; +} diff --git a/src/skins/admin/en/form_field/input/text/combobox.js b/src/skins/admin/en/form_field/input/text/combobox.js new file mode 100644 index 0000000000..532b3e6f98 --- /dev/null +++ b/src/skins/admin/en/form_field/input/text/combobox.js @@ -0,0 +1,29 @@ +/* vim: set ts=2 sw=2 sts=2 et: */ + +/** + * Float field microcontroller + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +CommonForm.elementControllers.push( + { + pattern: '.input-field-wrapper div.combobox-select', + handler: function () { + + jQuery(this).click( + function () { + var input = jQuery(this).parent().find('input'); + var minLength = input.autocomplete('option', 'minLength'); + input.autocomplete('option', 'minLength', 0); + input.autocomplete('search', ''); + input.autocomplete('option', 'minLength', minLength); + input.focus(); + } + ); + } + } +); diff --git a/src/skins/admin/en/form_field/input/text/combobox.tpl b/src/skins/admin/en/form_field/input/text/combobox.tpl new file mode 100644 index 0000000000..3b1f000416 --- /dev/null +++ b/src/skins/admin/en/form_field/input/text/combobox.tpl @@ -0,0 +1,16 @@ +{* vim: set ts=2 sw=2 sts=2 et: *} + +{** + * Common input template + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + *} + + + {displayCommentedData(getCommentedData())} + +
+
diff --git a/src/skins/admin/en/product_classes/list/main_input.tpl b/src/skins/admin/en/form_field/items_list.tpl similarity index 68% rename from src/skins/admin/en/product_classes/list/main_input.tpl rename to src/skins/admin/en/form_field/items_list.tpl index 31fb47d8ef..7697b01a79 100644 --- a/src/skins/admin/en/product_classes/list/main_input.tpl +++ b/src/skins/admin/en/form_field/items_list.tpl @@ -1,7 +1,7 @@ {* vim: set ts=2 sw=2 sts=2 et: *} {** - * Product classes main input widget + * Items list * * @author Creative Development LLC * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved @@ -9,6 +9,4 @@ * @link http://www.litecommerce.com/ *} - - - + diff --git a/src/skins/admin/en/form_field/radio.tpl b/src/skins/admin/en/form_field/radio.tpl new file mode 100644 index 0000000000..8c73e31668 --- /dev/null +++ b/src/skins/admin/en/form_field/radio.tpl @@ -0,0 +1,12 @@ +{* vim: set ts=2 sw=2 sts=2 et: *} + +{** + * Radio template + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + *} + + diff --git a/src/skins/admin/en/images/arrows-select.png b/src/skins/admin/en/images/arrows-select.png new file mode 100644 index 0000000000..ef4fef9586 Binary files /dev/null and b/src/skins/admin/en/images/arrows-select.png differ diff --git a/src/skins/admin/en/images/icon_folder.png b/src/skins/admin/en/images/icon_folder.png new file mode 100644 index 0000000000..92d96393d1 Binary files /dev/null and b/src/skins/admin/en/images/icon_folder.png differ diff --git a/src/skins/admin/en/images/icon_list.png b/src/skins/admin/en/images/icon_list.png new file mode 100644 index 0000000000..60de63671b Binary files /dev/null and b/src/skins/admin/en/images/icon_list.png differ diff --git a/src/skins/admin/en/images/icon_warning_round.png b/src/skins/admin/en/images/icon_warning_round.png new file mode 100644 index 0000000000..b67449b362 Binary files /dev/null and b/src/skins/admin/en/images/icon_warning_round.png differ diff --git a/src/skins/admin/en/items_list/model/table/parts/default.tpl b/src/skins/admin/en/items_list/model/table/parts/default.tpl new file mode 100644 index 0000000000..e024205f49 --- /dev/null +++ b/src/skins/admin/en/items_list/model/table/parts/default.tpl @@ -0,0 +1,12 @@ +{* vim: set ts=2 sw=2 sts=2 et: *} + +{** + * Default radio + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + *} + + diff --git a/src/skins/admin/en/items_list/model/table/style.css b/src/skins/admin/en/items_list/model/table/style.css index 4c9076de11..55c7c13ade 100644 --- a/src/skins/admin/en/items_list/model/table/style.css +++ b/src/skins/admin/en/items_list/model/table/style.css @@ -4,9 +4,10 @@ * Table-based model list * * @author Creative Development LLC - * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @copyright Copyright (c) 2011 Creative Development LLC . All rights reserved * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @link http://www.litecommerce.com/ + * @since 1.0.15 */ /** @@ -35,46 +36,25 @@ border-bottom: 1px solid #d5d5d5; } -.items-list-table table.list tbody tr.line td { +.items-list-table table.list tbody.lines tr.line td { border-top: 1px solid #e9e9e9; padding: 8px 12px 6px; line-height: 30px; white-space: nowrap; } -.items-list-table table.list tbody.lines tr.line td .plain-value { - line-height: 30px; - white-space: nowrap; -} - .items-list-table table.list tbody.lines tr.line.last td { border-bottom: 1px solid #e9e9e9; } -.items-list-table table.list tbody td.main { +.items-list-table table.list tbody.lines td.main { } .items-list-table table.list tbody.lines td, - .items-list-table table.list tbody.lines td .view, - .items-list-table table.list tbody.lines td .view *, - .items-list-table table.list tbody.lines td .plain-value -{ - font-size: 14px; -} - -.items-list-table table.list tbody.lines td.no-wrap .plain-value { - position: relative; - overflow: hidden; -} - -.items-list-table table.list tbody.lines td { - cursor: pointer; -} - .items-list-table table.list tbody.lines td .view, - .items-list-table table.list tbody.lines td .view * +.items-list-table table.list tbody.lines td .view * { - cursor: text; + font-size: 14px; } .items-list-table table.list tbody.lines td, @@ -83,9 +63,8 @@ vertical-align: middle; } -.items-list-table table.list tbody td.actions .separator { - position: absolute; - top: 16px; +.items-list-table table.list tbody.lines td.actions .separator { + display: inline-block; width: 3px; height: 20px; background-image: url(images/line-separator.png); @@ -93,36 +72,36 @@ background-position: top left; } -.items-list-table table.list tbody td.actions.left { - padding-right: 6px; +.items-list-table table.list tbody.lines td.actions.left { + padding-right: 0px; padding-left: 7px; } -.items-list-table table.list tbody td.actions.left .separator { - right: 0px; +.items-list-table table.list tbody.lines td.actions.left .separator { + margin-left: 6px; } -.items-list-table table.list tbody td.actions.right { - padding-left: 15px; +.items-list-table table.list tbody.lines td.actions.right { + padding-left: 0px; padding-right: 6px; } -.items-list-table table.list tbody td.actions.right .separator { - left: 0px; +.items-list-table table.list tbody.lines td.actions.right .separator { + margin-right: 12px; } -.items-list-table table.list tbody td.actions .action { +.items-list-table table.list tbody.lines td.actions .action { display: inline-block; padding-right: 2px; vertical-align: top; } -.items-list-table table.list tbody td.actions .action.next { +.items-list-table table.list tbody.lines td.actions .action.next { padding-left: 7px; background: transparent url(../../../images/actions_separator.png) no-repeat left 7px; } -.items-list-table table.list tbody td.actions div.selector { +.items-list-table table.list tbody.lines td.actions div.selector { width: 31px; height: 31px; text-align: center; @@ -130,68 +109,69 @@ margin-right: 5px; } -.items-list-table table.list tbody td.actions div.selector.checked { +.items-list-table table.list tbody.lines td.actions div.selector.checked { background-color: #d2f5cc; } -.items-list-table table.list tbody td.actions div.selector input { +.items-list-table table.list tbody.lines td.actions div.selector input { margin: 0px; vertical-align: middle; } -.items-list-table table.list tbody td.actions .inline-field .view { +.items-list-table table.list tbody.lines td.actions .inline-field .view { padding-top: 4px; } -.items-list-table table.list tbody td.actions .inline-switcher { +.items-list-table table.list tbody.lines td.actions .inline-switcher { width: 31px; padding-top: 7px; } -.items-list-table table.list tbody td.actions .inline-move { +.items-list-table table.list tbody.lines td.actions .inline-move { + height: 31px; padding-top: 8px; width: 37px; } -.items-list-table table.list tbody td.actions .inline-switcher .field { +.items-list-table table.list tbody.lines td.actions .inline-switcher .field { text-align: center; } -.items-list-table table.list tbody td a.link { +.items-list-table table.list tbody.lines td a.link { text-decoration: none; color: #456583; } -.items-list-table table.list tbody td.attention, -.items-list-table table.list tbody td.attention .view, -.items-list-table table.list tbody td.attention .view * +.items-list-table table.list tbody.lines td.attention, +.items-list-table table.list tbody.lines td.attention .view, +.items-list-table table.list tbody.lines td.attention .view * { color: #d91a1a; } -.items-list-table table.list tbody tr.line.remove-mark { +.items-list-table table.list tbody.lines tr.line.remove-mark { opacity: .3; } -.items-list-table table.list tbody .inline-field .field { +.items-list-table table.list tbody.lines .inline-field .field { line-height: normal; } -.items-list-table table.list tbody .inline-field .field input, -.items-list-table table.list tbody .inline-field .field select, -.items-list-table table.list tbody .inline-field .field textarea, -.items-list-table table.list tbody .inline-field .field span.text +.items-list-table table.list tbody.lines .inline-field .field input, +.items-list-table table.list tbody.lines .inline-field .field select, +.items-list-table table.list tbody.lines .inline-field .field textarea, +.items-list-table table.list tbody.lines .inline-field .field span.text { font-size: 14px; } -.items-list-table table.list tbody .inline-field .field input, -.items-list-table table.list tbody .inline-field .field select +.items-list-table table.list tbody.lines .inline-field .field input, +.items-list-table table.list tbody.lines .inline-field .field select { line-height: 18px; } -.items-list-table table.list tbody .inline-field .field input { +.items-list-table table.list tbody.lines .inline-field .field input { height: 19px; padding-top: 5px; padding-left: 6px; @@ -199,14 +179,14 @@ font-size: 14px; } -.items-list-table table.list tbody .inline-field .field select { +.items-list-table table.list tbody.lines .inline-field .field select { height: 29px; width: auto; margin-bottom: -2px; padding-top: 6px; } -.items-list-table table.list tbody .inline-field .table-value { +.items-list-table table.list tbody.lines .inline-field .table-value { float: none; } @@ -214,8 +194,8 @@ text-align: center; } -.items-list-table table.list tbody .field .subfield, -.items-list-table table.list tbody .field .subfield .table-value +.items-list-table table.list tbody.lines .field .subfield, +.items-list-table table.list tbody.lines .field .subfield .table-value { display: inline; } @@ -249,3 +229,13 @@ margin-top: 3px; margin-bottom: 3px; } + +.items-list-table table.list tbody td.main div span.value, +.items-list-table table.list tbody td.main div { + color: #456583; + font-size: 16px; +} + +.items-list-table table.list tbody td.main { + width: 300px; +} diff --git a/src/skins/admin/en/product/attributes.tpl b/src/skins/admin/en/product/attributes.tpl new file mode 100644 index 0000000000..a92cda8309 --- /dev/null +++ b/src/skins/admin/en/product/attributes.tpl @@ -0,0 +1,31 @@ +{* vim: set ts=2 sw=2 sts=2 et: *} + +{** + * "Attributes" tab + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + *} + + + +{foreach:product.getClasses(),class} + {foreach:class.getAttributeGroups(),group} + + {end:} +{end:} +
+ + +
+
+ +
+ diff --git a/src/skins/admin/en/product/attributes/fields.tpl b/src/skins/admin/en/product/attributes/fields.tpl new file mode 100644 index 0000000000..302fa2af59 --- /dev/null +++ b/src/skins/admin/en/product/attributes/fields.tpl @@ -0,0 +1,17 @@ +{* vim: set ts=2 sw=2 sts=2 et: *} + +{** + * Fields + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + *} + +

{getTitle()}

+
    +
  • + {w.display()} +
  • +
diff --git a/src/skins/admin/en/product/attributes/style.css b/src/skins/admin/en/product/attributes/style.css new file mode 100644 index 0000000000..dd83fd1d3a --- /dev/null +++ b/src/skins/admin/en/product/attributes/style.css @@ -0,0 +1,53 @@ +/* vim: set ts=2 sw=2 sts=2 et: */ + +/** + * Attributes + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +.tab-content h3 { + margin-top: 32px; + color: #333; +} + +.table-label label { + color: #456583; + font-size: 14px; +} + +.table-value span.input-field-wrapper { + float: left; +} + +.tab-content .form-field-comment { + font-size: 16px; + color: #8f8f8f; +} + +.tab-content label.separ-tab { + color: #456583; + font-size: 16px; + float: left; + margin: 5px; +} + +.tab-content .attrSepTab-value { + width: auto; + float: left; +} + +.tab-content li { + margin-bottom: 8px; +} + +.table-value.checkbox label { + margin: 0; +} + +.table-label.checkbox { + float: right; +} diff --git a/src/skins/admin/en/product_class/body.tpl b/src/skins/admin/en/product_class/body.tpl new file mode 100644 index 0000000000..14db7a8af5 --- /dev/null +++ b/src/skins/admin/en/product_class/body.tpl @@ -0,0 +1,11 @@ +{* vim: set ts=2 sw=2 sts=2 et: *} + +{** + * Product class page template + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + *} + \ No newline at end of file diff --git a/src/skins/admin/en/product_class/style.css b/src/skins/admin/en/product_class/style.css new file mode 100644 index 0000000000..1eeef3b5b2 --- /dev/null +++ b/src/skins/admin/en/product_class/style.css @@ -0,0 +1,10 @@ +/* vim: set ts=2 sw=2 sts=2 et: */ + +/** + * Product class view model styles + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ diff --git a/src/skins/admin/en/product_classes/body.tpl b/src/skins/admin/en/product_classes/body.tpl new file mode 100644 index 0000000000..f6a9b2fab1 --- /dev/null +++ b/src/skins/admin/en/product_classes/body.tpl @@ -0,0 +1,12 @@ +{* vim: set ts=2 sw=2 sts=2 et: *} + +{** + * Product classes page template + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + *} + + \ No newline at end of file diff --git a/src/skins/admin/en/product_classes/list.tpl b/src/skins/admin/en/product_classes/list.tpl new file mode 100644 index 0000000000..0f0fbf9121 --- /dev/null +++ b/src/skins/admin/en/product_classes/list.tpl @@ -0,0 +1,14 @@ +{* vim: set ts=2 sw=2 sts=2 et: *} + +{** + * Product classes list table template + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + *} + + + + \ No newline at end of file diff --git a/src/skins/admin/en/product_classes/list/body.tpl b/src/skins/admin/en/product_classes/list/body.tpl deleted file mode 100644 index fca0463e90..0000000000 --- a/src/skins/admin/en/product_classes/list/body.tpl +++ /dev/null @@ -1,36 +0,0 @@ -{* vim: set ts=2 sw=2 sts=2 et: *} - -{** - * Product classes list page - * - * @author Creative Development LLC - * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * @link http://www.litecommerce.com/ - *} - -{* Refactor to ItemsList*} - -
- -
- - - - - - - - - - - - -
- - - -
-
diff --git a/src/skins/admin/en/product_classes/list/css/style.css b/src/skins/admin/en/product_classes/list/css/style.css deleted file mode 100644 index 03868b4690..0000000000 --- a/src/skins/admin/en/product_classes/list/css/style.css +++ /dev/null @@ -1,49 +0,0 @@ -/* vim: set ts=2 sw=2 sts=2 et: */ - -/** - * Product classes list styles - * - * @author Creative Development LLC - * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * @link http://www.litecommerce.com/ - */ - -table.product-classes-list { - border-spacing: 0px; -} - -table.product-classes-list td { - border-bottom: solid 1px #eaeaea; -} - -table.product-classes-list tr:first-child td { - border-top: solid 1px #eaeaea; -} - -table.product-classes-list td.input-name { - width: 530px; -} - -.remove-product-class img.remove { - background: transparent url(../images/trash.png) 0 0 no-repeat; - width: 17px; - height: 16px; -} - -.remove-product-class img.separator { - background: transparent url(../images/separator.png) 0 0 repeat-y; - width: 1px; - height: 15px; - margin-right: 10px; -} - -.new-product-class .advanced-input-text .original-label:hover { - background-color: inherit; -} - -.new-product-class .advanced-input-text .original-label { - text-decoration: underline; - color: #154E9C; - cursor: pointer; -} diff --git a/src/skins/admin/en/product_classes/list/images/separator.png b/src/skins/admin/en/product_classes/list/images/separator.png deleted file mode 100644 index 6dab8c00eb..0000000000 Binary files a/src/skins/admin/en/product_classes/list/images/separator.png and /dev/null differ diff --git a/src/skins/admin/en/product_classes/list/images/trash.png b/src/skins/admin/en/product_classes/list/images/trash.png deleted file mode 100644 index 25cda0df6e..0000000000 Binary files a/src/skins/admin/en/product_classes/list/images/trash.png and /dev/null differ diff --git a/src/skins/admin/en/product_classes/list/js/script.js b/src/skins/admin/en/product_classes/list/js/script.js deleted file mode 100644 index f6c9206508..0000000000 --- a/src/skins/admin/en/product_classes/list/js/script.js +++ /dev/null @@ -1,221 +0,0 @@ -/* vim: set ts=2 sw=2 sts=2 et: */ - -/** - * Product classes list controller - * - * @author Creative Development LLC - * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * @link http://www.litecommerce.com/ - */ - -// Update with AJAX product class widget -window.core.updateProductClassAJAX = function (obj, widget) -{ - widget.input.attr('readonly', 'readonly'); - jQuery('img.progress', widget.inputBlock).addClass('ajax-progress'); - widget.cancel.hide(); - - var id = core.getProductClassId(widget); - var name = widget.input.val(); - var action = core.getProductClassAction(widget); - - jQuery.ajax( - { - type: 'get', - url: URLHandler.buildURL({'target': 'product_class', 'action': action, 'name': name, 'id' : id}), - timeout: 15000, - complete: function(xhr, s) { - widget.input.removeAttr('readonly'); - jQuery('img.progress', widget.inputBlock).removeClass('ajax-progress'); - widget.cancel.show(); - widget.cancelValue = name; - - obj.enterValue(widget); - - if ('add' === action) { - widget.input.val(''); - core.addProductClass(widget, jQuery.parseJSON(xhr.responseText).data); - } - } - } - ); // jQuery.ajax - -} - -window.core.addProductClass = function (widget, data) -{ - jQuery('img.progress', widget.inputBlock).addClass('ajax-progress'); - - jQuery.ajax( - { - type: 'get', - url: URLHandler.buildURL( - { - 'target': 'product_classes', - 'widget': '\\XLite\\View\\ProductClass\\MainInput', - 'className': data.name, - 'classId' : data.id - } - ), - timeout: 15000, - complete: function(xhr, s) { - - // TODO!!!! change it - var newRow = xhr.responseText.match(/
((\W|\w)+)<\/div>$/)[1]; - - jQuery('table.product-classes-list tr:last-child').before(newRow); - - var newHandler = new AdvancedInputHandler(); - - newHandler.changeActions(); - - jQuery('img.progress', widget.inputBlock).removeClass('ajax-progress'); - } - } - ); -} - -// Return product class id from widget -window.core.getProductClassId = function (widget) -{ - return widget.input.attr('id').toString().replace(/posteddata-|-name/g, ''); -} - -// Return product class action from widget -window.core.getProductClassAction = function (widget) -{ - return 'new' == core.getProductClassId(widget) ? 'add' : 'update'; -} - -// Decoration of the products list widget class -core.bind( - 'load', - function() { - - // Standard submit event handler is removed (AJAX is used) - jQuery('#product-class-form').submit( - function (event) { - event.preventDefault(); - } - ); - - // Decoration of 'enterValue' method of Advanced Input widget - decorate( - 'AdvancedInputHandler', - 'enterValue', - function (widget) - { - var prevLabel = widget.label.html(); - arguments.callee.previousMethod.apply(this, arguments); - - if (widget.label.closest('td').hasClass('new-product-class')) { - widget.label.html(prevLabel); - } - } - ); - - // Decoration of 'addActions' method of Advanced Input widget - decorate( - 'AdvancedInputHandler', - 'addActions', - function(widget) - { - // previous method call - arguments.callee.previousMethod.apply(this, arguments); - - var o = this; - - widget.input.keypress( - function (event) { - event.stopImmediatePropagation(); - - if (13 === event.which) { - event.preventDefault(); - - core.updateProductClassAJAX(o, widget); - } - } - ); - - widget.label.click(function (e) { - var obj = jQuery(this); - - e.stopImmediatePropagation(); - - jQuery(o.pattern).each(function () { - var widgetToUpdate = this.widget; - - if ( - widget.input.attr('name') != widgetToUpdate.input.attr('name') - ) { - if ( - 'add' != core.getProductClassAction(widgetToUpdate) - && 'none' != widgetToUpdate.inputBlock.css('display') - && widgetToUpdate.input.cancelValue != widgetToUpdate.input.val() - ) { - core.updateProductClassAJAX(o, widgetToUpdate); - } else { - o.enterValue(widgetToUpdate); - } - } - }); - - jQuery('body') - .unbind('click') - .bind( - 'click', - function (event) { - event.stopImmediatePropagation(); - - if ( - widget.input.cancelValue !== widget.input.val() - && 'update' === core.getProductClassAction(widget) - ) { - core.updateProductClassAJAX(o, widget); - } else { - o.enterValue(widget); - } - - }); - }); - - widget.cancel.click(function (event) { - event.stopImmediatePropagation(); - - o.cancel(widget); - }); - - var removeActionObject = jQuery('.remove-product-class a.remove', widget.inputBlock.closest('tr')); - var href = removeActionObject.attr('href'); - - removeActionObject.attr('href', 'javascript:void(0);'); - - removeActionObject.click( - function (event) { - var o = jQuery(this); - - event.stopPropagation(); - - jQuery('img.remove', o).removeClass('remove').addClass('ajax-progress'); - - jQuery.ajax( - { - type: 'get', - url: href, - timeout: 15000, - complete: function(xhr, s) { - jQuery('img.ajax-progress', o).addClass('remove').removeClass('ajax-progress'); - - o.closest('tr').slideUp('slow').remove(); - } - } - ); // jQuery.ajax - } - ); // o.click - - } // addActions method - ); // 'postprocess' method decoration (EXISTING method) - - } -); // core.bind() diff --git a/src/skins/admin/en/product_classes/list/parts/columns/remove.tpl b/src/skins/admin/en/product_classes/list/parts/columns/remove.tpl deleted file mode 100644 index dfba38d548..0000000000 --- a/src/skins/admin/en/product_classes/list/parts/columns/remove.tpl +++ /dev/null @@ -1,17 +0,0 @@ -{* vim: set ts=2 sw=2 sts=2 et: *} - -{** - * Remove button - * - * @author Creative Development LLC - * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * @link http://www.litecommerce.com/ - * - * @ListChild (list="product_classes.main_input", weight="200") - *} - - - | - {t(#Remove#)} - diff --git a/src/skins/admin/en/product_classes/parts/edit_attributes.tpl b/src/skins/admin/en/product_classes/parts/edit_attributes.tpl new file mode 100644 index 0000000000..10c734ddc7 --- /dev/null +++ b/src/skins/admin/en/product_classes/parts/edit_attributes.tpl @@ -0,0 +1,12 @@ +{* vim: set ts=2 sw=2 sts=2 et: *} + +{** + * Edit attributes + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + *} + +{t(#Edit attributes#)} ({entity.getAttributesCount()}) diff --git a/src/skins/admin/en/product_classes/style.css b/src/skins/admin/en/product_classes/style.css new file mode 100644 index 0000000000..8e5d03470d --- /dev/null +++ b/src/skins/admin/en/product_classes/style.css @@ -0,0 +1,19 @@ +/* vim: set ts=2 sw=2 sts=2 et: */ + +/** + * Product classes list styles + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + */ + +.items-list-table table.list tbody.lines td.cell span.products, +.items-list-table table.list tbody.lines td.cell a +{ + color: #8f8f8f; +} +.items-list-table table.list tbody.lines td.cell a { + text-decoration: underline; +} diff --git a/src/skins/default/en/css/lc.css b/src/skins/default/en/css/lc.css index af073fe2bf..b27b7567dd 100644 --- a/src/skins/default/en/css/lc.css +++ b/src/skins/default/en/css/lc.css @@ -1237,15 +1237,60 @@ div.product-details .continue-button-intend padding: 4px 0px; margin: 0px; background-image: none; - font-size: 16px; + font-size: 14px; } .product-details .extra-fields li strong { - width: 80px; font-weight: normal; + background-color: #fff; + padding-right: 3px; +} + +.product-details .extra-fields li h3 +{ + margin: 11px 0 0 0; + color: #456583; + font-size: 16px; +} + +.product-details .extra-fields li span +{ + display: inline-block; + color: #1f1f1f; +} + +.product-details .extra-fields li span.checkbox.no-checked +{ + color: #7e7e7e; +} + +.product-details .extra-fields li div +{ + width: 186px; display: inline-block; color: #7e7e7e; + background: url(../images/dotted.png) repeat-x scroll 0 bottom transparent; + vertical-align: top; +} + +.product-details .extra-fields li ul li div +{ + width: 166px; +} + +.product-details .extra-fields li ul li +{ + margin-top: 5px; +} + +.product-details .extra-fields li ul +{ + margin: 0 0 0 20px; +} + +.product-details .extra-fields ul { + line-height: 20px; } table.list-body td.hproduct a.product-thumbnail diff --git a/src/skins/default/en/images/dotted.png b/src/skins/default/en/images/dotted.png new file mode 100644 index 0000000000..e790c20f51 Binary files /dev/null and b/src/skins/default/en/images/dotted.png differ diff --git a/src/skins/default/en/product/details/parts/attribute.tpl b/src/skins/default/en/product/details/parts/attribute.tpl new file mode 100644 index 0000000000..df6f8db47c --- /dev/null +++ b/src/skins/default/en/product/details/parts/attribute.tpl @@ -0,0 +1,22 @@ +{* vim: set ts=2 sw=2 sts=2 et: *} + +{** + * Attribute + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + *} +{if:getAttributeGroup()} +
  • {getTitle()}

    +
      +{end:} +
    • +
      {a.name}
      + {a.value:nl2br} +
    • +{if:getAttributeGroup()} +
    +
  • +{end:} diff --git a/src/skins/default/en/product/details/parts/common.product-attributes-list.tpl b/src/skins/default/en/product/details/parts/common.product-attributes-list.tpl new file mode 100644 index 0000000000..f7f265a275 --- /dev/null +++ b/src/skins/default/en/product/details/parts/common.product-attributes-list.tpl @@ -0,0 +1,18 @@ +{* vim: set ts=2 sw=2 sts=2 et: *} + +{** + * Product attributes + * + * @author Creative Development LLC + * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @link http://www.litecommerce.com/ + * + * @ListChild (list="product.details.common.product-attributes.attributes", weight="10") + *} + +{foreach:product.getClasses(),class} + {foreach:class.getAttributeGroups(),group} + + {end:} +{end:} diff --git a/src/skins/admin/en/product_classes/list/parts/columns/main.tpl b/src/skins/default/en/product/details/parts/common.product-attributes.attributes.tpl similarity index 55% rename from src/skins/admin/en/product_classes/list/parts/columns/main.tpl rename to src/skins/default/en/product/details/parts/common.product-attributes.attributes.tpl index 6c5ce34dbe..218a8127c6 100644 --- a/src/skins/admin/en/product_classes/list/parts/columns/main.tpl +++ b/src/skins/default/en/product/details/parts/common.product-attributes.attributes.tpl @@ -1,16 +1,14 @@ {* vim: set ts=2 sw=2 sts=2 et: *} {** - * Product classes list item + * Product attributes * * @author Creative Development LLC * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @link http://www.litecommerce.com/ * - * @ListChild (list="product_classes.main_input", weight="100") + * @ListChild (list="product.details.common.product-attributes", weight="300") *} - - - + diff --git a/src/skins/default/en/product/details/parts/common.product-attributes.sku.tpl b/src/skins/default/en/product/details/parts/common.product-attributes.sku.tpl index 54a51128f2..4ed35ef694 100644 --- a/src/skins/default/en/product/details/parts/common.product-attributes.sku.tpl +++ b/src/skins/default/en/product/details/parts/common.product-attributes.sku.tpl @@ -11,6 +11,6 @@ * @ListChild (list="product.details.common.product-attributes", weight="200") *}
  • - {t(#SKU#)}: +
    {t(#SKU#)}
    {product.sku}
  • diff --git a/src/skins/default/en/product/details/parts/common.product-attributes.weight.tpl b/src/skins/default/en/product/details/parts/common.product-attributes.weight.tpl index fe587bea36..3dad39bc8b 100644 --- a/src/skins/default/en/product/details/parts/common.product-attributes.weight.tpl +++ b/src/skins/default/en/product/details/parts/common.product-attributes.weight.tpl @@ -11,6 +11,6 @@ * @ListChild (list="product.details.common.product-attributes", weight="100") *}
  • - {t(#Weight#)}: +
    {t(#Weight#)}
    {product.weight} {config.General.weight_symbol}
  • diff --git a/src/skins/admin/en/product_classes/list/parts/columns/new.tpl b/src/skins/default/en/product/details/parts/page.tabs.attributes.tpl similarity index 52% rename from src/skins/admin/en/product_classes/list/parts/columns/new.tpl rename to src/skins/default/en/product/details/parts/page.tabs.attributes.tpl index a30ebcb3b1..9de4974935 100644 --- a/src/skins/admin/en/product_classes/list/parts/columns/new.tpl +++ b/src/skins/default/en/product/details/parts/page.tabs.attributes.tpl @@ -1,17 +1,15 @@ {* vim: set ts=2 sw=2 sts=2 et: *} {** - * Product class new element + * Product details attributes tab * * @author Creative Development LLC * @copyright Copyright (c) 2011-2012 Creative Development LLC . All rights reserved * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @link http://www.litecommerce.com/ * - * @ListChild (list="productClasses.list.columns.new", weight="100") + * @ListChild (list="product.details.page.tab.attributes", weight="10") *} - - - - -  +
      + +