ePages 7.38.0 - DE_EPAGES/Product/UI/JSON.pm

Package DE_EPAGES::Product::UI::JSON

Common user interface to show, save and delete objects.

Functions

JSONHandleProductImagesUnity
JSONSaveMBOUI
JSONSaveNewFile
JSONSearchProducts
JSONSetProductImageForSameVariations
JSONUploadImageForSameVariations
RequestPrettyUnityUrl

JSONHandleProductImagesUnity

Called to upload, delete, rearange an image for a product.

Syntax
$Handler->JSONHandleProductImagesUnity($Servlet);
Input
$Servlet (object)
servlet object

JSONSaveMBOUI

Called for product detail page for saving each section's position and visibility.

Syntax
$Handler->JSONSaveMBOUI($Servlet);
Input
$Servlet (object)
servlet object

JSONSaveNewFile

Called for product image slideshow images upon image upload.

Syntax
$Handler->JSONSaveNewFile($Servlet);
Input
$Servlet (object)
servlet object

JSONSearchProducts

JSON handler for product search

Syntax
$Handler->JSONSearchProducts($Servlet);
Example
<button onclick="dosth(); return false;">dosth</button>
<script type="text/javascript">
  window.dosth = function() {
    var result = new epages.io.Json().loadSync('?', {
                  'ObjectID'          : #Shop.ProductFolder.ID, // Product folder
                  'ViewAction'        : 'JSONSearchProducts',
                  'WildSearchString'  : 'Jack',
                  'ErrorAction'       : 'JSONViewResponse',
                  'IsAppointment'     : 0,
                  'OrderBy'           : 'NameOrAlias',
                  'OrderDesc'         : 0,
                  'PagerPage'         : 2
                });
    if(result && result.error && result.error.data){
      console.warn("todo: handle error", result.error.data);
    } else {
      console.debug("result", result, result.data);
    }
  };
</script>
Input
$Servlet (object)
servlet object

JSONSetProductImageForSameVariations

Set the product images for variations with the same attribute to the main product images.

Syntax
$Handler->JSONSetProductImageForSameVariations($Servlet);
Input
$Servlet (object)
servlet object

JSONUploadImageForSameVariations

Called to upload an image, generate all product images and set them for all variations with the same attribute.

Syntax
$Handler->JSONUploadImageForSameVariations($Servlet);
Input
$Servlet (object)
servlet object

RequestPrettyUnityUrl

Performs a HEAD request to the Unity storefront in order to get the pretty URL of the given object out of its PrettyUnitUrl. In case it is new or has changed, this value is written to the database to have faster access to it next time. It is used to show the SEO preview at the product detail page.

Syntax
$Handler->RequestPrettyUnityUrl($Servlet);
Input
$Servlet (object)
servlet object