ShopLibrary
in package
All the helping hands needed to run the shop
Tags
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'
Methods
- getCustomOrderId() : string
- Convert the order ID and date to a custom order ID of the form "lastnameYYY", where YYY is the order ID.
- 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
- 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
- stripUniqidFromFilename() : string
- Remove the uniqid part from a file name that was added after uploading the file
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'
noPictureName
public
mixed
noPictureName
= 'no_picture.gif'
PAYMENT_RESULT_CANCEL
public
mixed
PAYMENT_RESULT_CANCEL
= 2
PAYMENT_RESULT_FAIL
public
mixed
PAYMENT_RESULT_FAIL
= 0
PAYMENT_RESULT_SUCCESS
public
mixed
PAYMENT_RESULT_SUCCESS
= 1
PAYMENT_RESULT_SUCCESS_SILENT
Payment result constant values
public
mixed
PAYMENT_RESULT_SUCCESS_SILENT
= -1
Tags
REGISTER_MANDATORY
public
mixed
REGISTER_MANDATORY
= 'mandatory'
REGISTER_NONE
public
mixed
REGISTER_NONE
= 'none'
REGISTER_OPTIONAL
public
mixed
REGISTER_OPTIONAL
= 'optional'
thumbnailSuffix
public
mixed
thumbnailSuffix
= '.thumb'
Methods
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
Return values
string —The custom order ID
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
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
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
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
Return values
bool —The Customers' e-mail address on success, false 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