Exemple #1
0
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with Pastèque.  If not, see <http://www.gnu.org/licenses/>.
namespace ProductAttributes;

$message = null;
$error = null;
if (isset($_POST['delete-set'])) {
    if (\Pasteque\AttributesService::deleteSet($_POST['delete-set'])) {
        $message = \i18n("Changes saved");
    } else {
        $error = \i18n("Unable to save changes");
    }
}
$sets = \Pasteque\AttributesService::getAll();
?>
<h1><?php 
\pi18n("Attribute sets", PLUGIN_NAME);
?>
</h1>

<?php 
\Pasteque\tpl_msg_box($message, $error);
?>

<?php 
\Pasteque\tpl_btn('btn', \Pasteque\get_module_url_action(PLUGIN_NAME, "set_edit"), \i18n('Add an attribute set', PLUGIN_NAME), 'img/btn_add.png');
?>

<table cellpadding="0" cellspacing="0">
Exemple #2
0
} else {
    if (isset($_POST['label'])) {
        // Create attribute
        $set = new \Pasteque\AttributeSet($_POST['label']);
        foreach ($_POST['id-attr'] as $attrId) {
            if ($attrId !== null && $attrId !== "") {
                $attr = \Pasteque\Attribute::__build($attrId, "unused", null);
                $set->addAttribute($attr, null);
            }
        }
        \Pasteque\AttributesService::createSet($set);
    }
}
$set = null;
if (isset($_GET['id'])) {
    $set = \Pasteque\AttributesService::get($_GET['id']);
}
?>
<h1><?php 
\pi18n("Edit attribute set", PLUGIN_NAME);
?>
</h1>

<?php 
\Pasteque\tpl_msg_box($message, $error);
?>

<!-- Attribute edit -->
<form class="edit" action="<?php 
echo \Pasteque\get_current_url();
?>
} else {
    if (isset($_POST['label'])) {
        // Create attribute
        $attr = new \Pasteque\Attribute($_POST['label'], null);
        \Pasteque\AttributesService::createAttribute($attr);
        foreach ($_POST['label-new'] as $newVal) {
            if ($newVal !== null && $newVal !== "") {
                $newValObj = new \Pasteque\AttributeValue($newVal);
                \Pasteque\AttributesService::createValue($newValObj, $attr->id);
            }
        }
    }
}
$attribute = null;
if (isset($_GET['id'])) {
    $attribute = \Pasteque\AttributesService::getAttribute($_GET['id']);
}
?>
<h1><?php 
\pi18n("Edit attribute", PLUGIN_NAME);
?>
</h1>

<?php 
\Pasteque\tpl_msg_box($message, $error);
?>

<!-- Attribute edit -->
<form class="edit" action="<?php 
echo \Pasteque\get_current_url();
?>
Exemple #4
0
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with Pastèque.  If not, see <http://www.gnu.org/licenses/>.
namespace ProductAttributes;

$message = null;
$error = null;
if (isset($_POST['delete-attribute'])) {
    if (\Pasteque\AttributesService::deleteAttribute($_POST['delete-attribute'])) {
        $message = \i18n("Changes saved");
    } else {
        $error = \i18n("Unable to save changes");
    }
}
$attributes = \Pasteque\AttributesService::getAllAttrs();
?>
<h1><?php 
\pi18n("Attributes", PLUGIN_NAME);
?>
</h1>

<?php 
\Pasteque\tpl_msg_box($message, $error);
?>

<?php 
\Pasteque\tpl_btn('btn', \Pasteque\get_module_url_action(PLUGIN_NAME, "attribute_edit"), \i18n('Add an attribute', PLUGIN_NAME), 'img/btn_add.png');
?>

<table cellpadding="0" cellspacing="0">