Documentation

ShopManager extends ShopLibrary
in package

Administration of the Shop

Tags
copyright

CLOUDREXX CMS - CLOUDREXX AG

author

Reto Kohli reto.kohli@comvation.com

author

Ivan Schmid ivan.schmid@comvation.com

access

public

subpackage

module_shop

version
3.0.0

Table of Contents

Constants

IMAGE_PARSE_BEHAVIOUR_FILLING  = 'filling'
If set through setting option image_parse_behaviour, then the related image placeholders of a product will be parsed with any set images.
IMAGE_PARSE_BEHAVIOUR_FIXED  = 'fixed'
If set through setting option image_parse_behaviour, then the related image placeholders of a product will be parsed excatly as set.
noPictureName  = 'no_picture.gif'
PAYMENT_RESULT_CANCEL  = 2
PAYMENT_RESULT_FAIL  = 0
PAYMENT_RESULT_SUCCESS  = 1
PAYMENT_RESULT_SUCCESS_SILENT  = -1
Payment result constant values
REGISTER_MANDATORY  = 'mandatory'
REGISTER_NONE  = 'none'
REGISTER_OPTIONAL  = 'optional'
thumbnailSuffix  = '.thumb'

Properties

$act  : mixed
$defaultImage  : mixed
$objTemplate  : Sigma
The Template object
$pageTitle  : mixed

Methods

__construct()  : shopmanager
Constructor
_deleteAttribute()  : string
Delete one or more Attribute
_import()  : mixed
Import and Export data from/to csv
_storeNewAttributeOption()  : string
Store a new attribute option
_updateAttributeOptions()  : bool
Updates Attribute options in the database
customer_activate()  : void
Activates or deactivates Users
delete_article_group()  : bool
OBSOLETE Deletes the article group selected by its ID from the GET request
delete_customer()  : bool
Deletes a Customer
delete_customer_group()  : bool
OBSOLETE Deletes the customer group selected by its ID from the GET request
delete_discount_count()  : bool
Delete the count discount selected by its ID from the GET request
delete_order()  : void
Delete one or more Orders
delete_product()  : bool
Delete one or more Products from the database.
error_database()  : bool
Set the database query error Message
getCustomOrderId()  : string
Convert the order ID and date to a custom order ID of the form "lastnameYYY", where YYY is the order ID.
getMonthDropdownMenu()  : mixed
getPage()  : mixed
Set up the shop admin page
getRegisterArray()  : array<string|int, mixed>
Returns an array with all register options
getRegisterMenuoptions()  : string
Returns HTML code for the register menu options
getSubstitutionArray()  : array<string|int, mixed>
Returns an array of values to be substituted
getYearDropdownMenu()  : mixed
moveImage()  : bool
Moves Product or Category images to the shop image folder if necessary and changes the given file path from absolute to relative to the shop image folder
scaleImageSizeToThumbnail()  : array<string|int, mixed>
Scale the given image size down to thumbnail size
sendConfirmationMail()  : bool
Send a confirmation e-mail with the order data
sendProcessedMail()  : bool
Send an e-mail to the Customer with the confirmation that the Order with the given Order ID has been processed
store_discount_count()  : bool
Store the count discounts after editing
store_discount_customer()  : bool
Store the customer and article group discount rates after editing
store_product()  : bool
Stores the posted Product, if any
storeCustomerFromPost()  : int
Store a customer
stripUniqidFromFilename()  : string
Remove the uniqid part from a file name that was added after uploading the file
toggle_category()  : bool
Toggles the active state of a ShopCategory
toggleCustomer()  : bool
Toggles the active state of a Customer
update_categories()  : bool
Update all ShopCategories with the data provided by the request.
update_manufacturers()  : bool
Updates the Manufacturers in the database
update_products()  : bool
Store any Products that have been modified.
view_article_groups()  : bool
Show the article groups for editing
view_attributes_edit()  : mixed
Attributes and options edit view
view_categories()  : bool
Produces the Categories overview
view_customer_details()  : mixed
Set up the customer details
view_customer_discounts()  : bool
Show the customer and article group discounts for editing.
view_customer_edit()  : mixed
Edit a Customer
view_customer_groups()  : bool
Show the customer groups for editing
view_customers()  : mixed
Show Customers
view_discount_groups_count()  : bool
Show the count discount editing page
view_order_details()  : mixed
OBSOLETE -- Moved to Order class Set up details of the selected order
view_order_overview()  : mixed
Show the stored orders
view_pricelist_edit()  : bool
Edit a pricelist
view_product_edit()  : string
Manage products
view_product_overview()  : mixed
Show Products
view_products()  : mixed
view_settings()  : mixed
Set up the common elements and individual content of various settings pages
view_settings_countries()  : mixed
The country settings view
view_settings_currency()  : mixed
The currency settings view
view_settings_general()  : mixed
view_settings_mail()  : bool
The mailtemplate settings view
view_settings_shipment()  : mixed
The shipment settings view
view_settings_vat()  : mixed
view_settings_zones()  : mixed
The zones settings view
checkProfileAttributes()  : mixed
delete_category()  : bool
Deletes one ShopCategory
getAnchorTag()  : HtmlElement
Get HTML-a tag
store_category()  : bool
Insert or update a ShopCategory with data provided in the request.
view_manufacturers()  : void
Manages manufacturers
view_pricelists()  : void
Shows an overview of all pricelists
setNavigation()  : mixed
viewpart_product_attributes()  : void
Partial view of the Attributes for a Product being edited

Constants

IMAGE_PARSE_BEHAVIOUR_FILLING

If set through setting option image_parse_behaviour, then the related image placeholders of a product will be parsed with any set images.

public string IMAGE_PARSE_BEHAVIOUR_FILLING = 'filling'

IMAGE_PARSE_BEHAVIOUR_FIXED

If set through setting option image_parse_behaviour, then the related image placeholders of a product will be parsed excatly as set.

public string IMAGE_PARSE_BEHAVIOUR_FIXED = 'fixed'

Properties

Methods

__construct()

Constructor

public __construct() : shopmanager
Tags
access

public

Return values
shopmanager

_deleteAttribute()

Delete one or more Attribute

public _deleteAttribute(mixed $attribute_id) : string
Parameters
$attribute_id : mixed

The Attribute ID or an array of IDs

Tags
access

private

Return values
string

The empty string on success, some status message on failure

_storeNewAttributeOption()

Store a new attribute option

public _storeNewAttributeOption() : string
Tags
access

private

Return values
string

$statusMessage Status message

_updateAttributeOptions()

Updates Attribute options in the database

public _updateAttributeOptions() : bool
Tags
access

private

Return values
bool

True on success, null on noop, or false otherwise

customer_activate()

Activates or deactivates Users

public static customer_activate() : void

Picks User IDs from $_POST['selected_customer_id'] and the desired active status from $_POST['multi_action']. If either is empty, does nothing. Appropriate messages are set by User::set_active().

delete_article_group()

OBSOLETE Deletes the article group selected by its ID from the GET request

public delete_article_group() : bool
Tags
author

Reto Kohli reto.kohli@comvation.com

Return values
bool

True on success, false otherwise

delete_customer()

Deletes a Customer

public delete_customer() : bool

Picks the Customer ID from either $_GET['customer_id'] or $_POST['selected_customer_id'], in that order, whichever is present first. Sets appropriate messages. Aborts immediately upon errors, so the remaining Customers won't be deleted.

Return values
bool

True on success, false otherwise

delete_customer_group()

OBSOLETE Deletes the customer group selected by its ID from the GET request

public delete_customer_group() : bool
Tags
author

Reto Kohli reto.kohli@comvation.com

todo

Seems that this is unused!?

Return values
bool

True on success, false otherwise

delete_discount_count()

Delete the count discount selected by its ID from the GET request

public delete_discount_count() : bool
Tags
author

Reto Kohli reto.kohli@comvation.com

Return values
bool

True on success, false otherwise

delete_order()

Delete one or more Orders

public delete_order([int $order_id = null ]) : void

If the $order_id parameter value is empty, checks $_GET['order_id'] and $_POST['selectedOrderId'] in this order for Order IDs. Backend use only. Redirects to the Order overview

Parameters
$order_id : int = null

The optional Order ID to be deleted

Tags
version
3.0.0

delete_product()

Delete one or more Products from the database.

public delete_product([int $product_id = 0 ]) : bool

Checks whether either of the request parameters 'id' (integer) or 'selectedProductId' (array) is present, in that order, and takes the ID of the Product(s) from the first one available, if any. If none of them is set, uses the value of the $product_id argument, if that is valid. Note that this method returns true if no record was deleted because no ID was supplied.

Parameters
$product_id : int = 0

The optional Product ID to be deleted.

Return values
bool

True on success, false otherwise

error_database()

Set the database query error Message

public error_database() : bool
Tags
global

array $_ARRAYLANG

Return values
bool

False

getCustomOrderId()

Convert the order ID and date to a custom order ID of the form "lastnameYYY", where YYY is the order ID.

public static getCustomOrderId(int $order_id) : string

This method may be customized to meet the needs of any shop owner. The custom order ID may be used for creating user accounts for protected downloads, for example.

Parameters
$order_id : int

The order ID

Tags
global

ADONewConnection $objDatabase Database connection object

author

Reto Kohli reto.kohli@comvation.com

Return values
string

The custom order ID

getMonthDropdownMenu()

public static getMonthDropdownMenu([mixed $selected = NULL ]) : mixed
Parameters
$selected : mixed = NULL

getRegisterArray()

Returns an array with all register options

public static getRegisterArray() : array<string|int, mixed>

Keys are the respective class constant values, and the element values are the language entries.

Tags
see
getRegisterMenuoptions()
Return values
array<string|int, mixed>

The array of register options

getRegisterMenuoptions()

Returns HTML code for the register menu options

public static getRegisterMenuoptions([string $selected = null ]) : string
Parameters
$selected : string = null

The optional selected option

Tags
see
getRegisterArray()
Return values
string

The HTML options string

getSubstitutionArray()

Returns an array of values to be substituted

public static getSubstitutionArray() : array<string|int, mixed>

Contains the following keys and values: 'SHOP_COMPANY' => The company name (from the settings) 'SHOP_HOMEPAGE' => The shop starting page URL Used primarily for all MailTemplates. Indexed by placeholder names.

Return values
array<string|int, mixed>

The substitution array

getYearDropdownMenu()

public static getYearDropdownMenu([mixed $selected = NULL ][, mixed $startYear = NULL ]) : mixed
Parameters
$selected : mixed = NULL
$startYear : mixed = NULL

moveImage()

Moves Product or Category images to the shop image folder if necessary and changes the given file path from absolute to relative to the shop image folder

public static moveImage(string &$imageFileSource) : bool

Images outside the shop image folder are copied there and all folder parts are stripped. Images inside the shop image folder are left where they are. The path is changed to represent the new location, relative to the shop image folder. Leading folder separators are removed. The changed path SHOULD be stored in the picture field as-is. Examples (suppose the shop image folder ASCMS_SHOP_IMAGES_WEB_PATH is 'images/shop'): /var/www/mydomain/upload/test.jpg becomes images/shop/test.jpg /var/www/mydomain/images/shop/test.jpg becomes images/shop/test.jpg /var/www/mydomain/images/shop/folder/test.jpg becomes images/shop/folder/test.jpg

Parameters
$imageFileSource : string

The absolute image path, by reference

Return values
bool

True on success, false otherwise

scaleImageSizeToThumbnail()

Scale the given image size down to thumbnail size

public static scaleImageSizeToThumbnail(array<string|int, mixed> &$arrSize) : array<string|int, mixed>

The target thumbnail size is taken from the configuration. The argument and returned arrays use the indices as follows: array(0 => width, 1 => height) In addition, index 3 of the array returned contains a string with the width and height attribute string, very much like the result of getimagesize(). Note that the array argument is passed by reference and its values overwritten for the indices mentioned!

Parameters
$arrSize : array<string|int, mixed>

The original image size array, by reference

Return values
array<string|int, mixed>

The scaled down (thumbnail) image size array

sendConfirmationMail()

Send a confirmation e-mail with the order data

public static sendConfirmationMail(int $order_id[, bool $create_accounts = true ]) : bool

Calls Orders::getSubstitutionArray(), which en route creates User accounts for individual electronic Products by default. Set $create_accounts to false when sending a copy.

Parameters
$order_id : int

The order ID

$create_accounts : bool = true

Create User accounts for electronic Products it true

Tags
static
access

private

Return values
bool

The Customers' e-mail address on success, false otherwise

sendProcessedMail()

Send an e-mail to the Customer with the confirmation that the Order with the given Order ID has been processed

public static sendProcessedMail(int $order_id) : bool
Parameters
$order_id : int

The order ID

Return values
bool

True on success, false otherwise

store_discount_count()

Store the count discounts after editing

public store_discount_count() : bool
Tags
author

Reto Kohli reto.kohli@comvation.com

Return values
bool

True on success, false otherwise

store_discount_customer()

Store the customer and article group discount rates after editing

public store_discount_customer() : bool
Tags
author

Reto Kohli reto.kohli@comvation.com

Return values
bool

True on success, false otherwise

store_product()

Stores the posted Product, if any

public static store_product() : bool
Return values
bool

True on success, null on noop, false otherwise

storeCustomerFromPost()

Store a customer

public static storeCustomerFromPost() : int

Sets a Message according to the outcome. Note that failure to send the e-mail with login data is not considered an error and will only produce a warning.

Tags
author

Reto Kohli reto.kohli@comvation.com

Return values
int

The Customer ID on success, null otherwise

stripUniqidFromFilename()

Remove the uniqid part from a file name that was added after uploading the file

public static stripUniqidFromFilename(string $strFilename) : string

The file name to be matched should look something like filename[uniqid].ext Where uniqid is a 13 digit hexadecimal value created by uniqid(). This method will then return filename.ext

Parameters
$strFilename : string

The file name with the uniqid

Return values
string

The original file name

toggle_category()

Toggles the active state of a ShopCategory

public toggle_category() : bool

The ShopCategory ID may be present in $_REQUEST['toggle_category_id']. If it's not, returns NULL immediately. Otherwise, will add a message indicating success or failure, and redirect back to the category overview.

Tags
global

array $_ARRAYLANG

Return values
bool

Null on noop

toggleCustomer()

Toggles the active state of a Customer

public toggleCustomer() : bool

The Customer ID may be present in $_REQUEST['toggle_customer_id']. If it's not, returns NULL immediately. Otherwise, will add a message indicating success or failure, and redirect back to the customer overview.

Tags
global

array $_ARRAYLANG

Return values
bool

Null on noop

update_categories()

Update all ShopCategories with the data provided by the request.

public update_categories() : bool
Tags
author

Reto Kohli reto.kohli@comvation.com

Return values
bool

True on success, null on noop, false otherwise.

update_manufacturers()

Updates the Manufacturers in the database

public static update_manufacturers() : bool

Stores or deletes records depending on the contents of the current request

Return values
bool

True on success, null on noop, false otherwise

update_products()

Store any Products that have been modified.

public update_products() : bool

Takes the Product data directly from the various fields of the $_POST array. Only updates the database records for Products that have at least one of their values changed.

Tags
global

array $_ARRAYLANG Language array

Return values
bool

True on success, false otherwise.

view_article_groups()

Show the article groups for editing

public view_article_groups() : bool
Tags
author

Reto Kohli reto.kohli@comvation.com

Return values
bool

True on success, false otherwise

view_attributes_edit()

Attributes and options edit view

public view_attributes_edit() : mixed
Tags
access

private

view_categories()

Produces the Categories overview

public view_categories() : bool
Return values
bool

True on success, false otherwise

view_customer_details()

Set up the customer details

public view_customer_details() : mixed

view_customer_discounts()

Show the customer and article group discounts for editing.

public view_customer_discounts() : bool

Handles storing of the discounts as well.

Tags
author

Reto Kohli reto.kohli@comvation.com

Return values
bool

True on success, false otherwise

view_customer_groups()

Show the customer groups for editing

public view_customer_groups() : bool
Tags
author

Reto Kohli reto.kohli@comvation.com

Return values
bool

True on success, false otherwise

view_discount_groups_count()

Show the count discount editing page

public view_discount_groups_count() : bool
Tags
author

Reto Kohli reto.kohli@comvation.com

Return values
bool

True on success, false otherwise

view_order_details()

OBSOLETE -- Moved to Order class Set up details of the selected order

public view_order_details([bool $edit = false ]) : mixed
Parameters
$edit : bool = false

Edit if true, view otherwise

Tags
access

public

global

ADONewConnection $objDatabase Database connection object

global

array $_ARRAYLANG Language array

author

Reto Kohli reto.kohli@comvation.com

view_order_overview()

Show the stored orders

public view_order_overview() : mixed
Tags
access

public

global

ADONewConnection $objDatabase Database connection object

global

array $_ARRAYLANG

global

array $_CONFIG

author

Reto Kohli reto.kohli@comvation.com

view_pricelist_edit()

Edit a pricelist

public static view_pricelist_edit() : bool
Tags
global

ADOConnection $objDatabase

global

array $_ARRAYLANG

Return values
bool

True on success, false otherwise

view_product_overview()

Show Products

public view_product_overview() : mixed

view_settings()

Set up the common elements and individual content of various settings pages

public static view_settings() : mixed

Includes VAT, shipping, countries, zones and more

Tags
access

private

static

view_settings_countries()

The country settings view

public static view_settings_countries() : mixed

view_settings_currency()

The currency settings view

public static view_settings_currency() : mixed

view_settings_mail()

The mailtemplate settings view

public static view_settings_mail() : bool

Stores MailTemplates posted from the MailTemplate::edit() view. Deletes a MailTemplate on request from the MailTemplate::overview() view. Includes both the overview and the edit view, activates one depending on the outcome of the call to MailTemplate::storeFromPost().

Return values
bool

True on success, false otherwise

view_settings_shipment()

The shipment settings view

public static view_settings_shipment() : mixed

view_settings_zones()

The zones settings view

public static view_settings_zones() : mixed

This dialouge provides the ability to group countries that have been enabled for shipment into zones.

delete_category()

Deletes one ShopCategory

protected delete_category() : bool

The ID of the ShopCategory to delete is taken from $_GET['delete_category_id']. Only succeeds if there are no subcategories, and if all contained Products can be deleted as well. Products that are present in any order won't be deleted.

Return values
bool

True on success, null on noop, false otherwise.

getAnchorTag()

Get HTML-a tag

protected getAnchorTag(mixed $label, mixed $url) : HtmlElement

Generate a HTML-a-tag with label (inner text-node) $label and URL (href-attribute) set to $url

Parameters
$label : mixed

string Label to use as inner text-node of anchor tag

$url : mixed

\Cx\Core\Routing\Url Url to use as href-attribute

Return values
HtmlElement

HtmlElement of type a

store_category()

Insert or update a ShopCategory with data provided in the request.

protected store_category() : bool
Tags
author

Reto Kohli reto.kohli@comvation.com

Return values
bool

True on success, null on noop, false otherwise.

view_manufacturers()

Manages manufacturers

protected view_manufacturers() : void

view_pricelists()

Shows an overview of all pricelists

protected static view_pricelists() : void

Also processes requests for deleting one or more Pricelists.

Tags
global

array $_ARRAYLANG

global

ADOConnection $objDatabase Database connection object

viewpart_product_attributes()

Partial view of the Attributes for a Product being edited

private static viewpart_product_attributes([int $product_id = null ]) : void

Only called by view_product_edit(). Mind that the $product_id may be empty (usually zero) for new Products.

Parameters
$product_id : int = null

The ID of the Product being edited

Tags
access

private


        
On this page

Search results