Hi Devbest members,
Tonight I was busy making something for my CMS and that is that you can easily create an exchange-value page without any difficulty.
You can find my live example here:
I can add catalog_pages in my housekeeping value manager which i want to use under my exchange value category.
(Pages is just a field in with arrays)
You can change the value of the items when you click on the edit button
In my housekeeping it look like this:
When you change the value, the rate will automatically adjust (up/down).
Important
This is just an idea how you can do it in housekeeping, the script I am about to release only shows an array that you can use.
API
If you have no idea how to implement this, you can also use my API catalogue based on Arcturus Morningstar.
If you gonna use this, be aware that this is only shows the Morningstar catalogue with currencys (0,5,103).
@param [catalog_pages:id, [catalog_pages:id] .. (you can add as many as you want by adding a *).
Source
I'm using a QueryBuilder so you need to change the queries to get this working.
If you need some help ask me.
I will add this soon for AsteroidCMS>
Thanks!
Raizer
Tonight I was busy making something for my CMS and that is that you can easily create an exchange-value page without any difficulty.
You can find my live example here:
You must be registered for see links
marketplaceI can add catalog_pages in my housekeeping value manager which i want to use under my exchange value category.
(Pages is just a field in with arrays)
Code:
INSERT INTO `website_rare_values` VALUES (1, 'catalogue-rares', 'Catalogue Rares', '[348, 327]', '0');
INSERT INTO `website_rare_values` VALUES (5, 'limited-edition', 'Limited Edition', '[520, 311]', '0');
You can change the value of the items when you click on the edit button
In my housekeeping it look like this:
You must be registered for see links
When you change the value, the rate will automatically adjust (up/down).
Important
This is just an idea how you can do it in housekeeping, the script I am about to release only shows an array that you can use.
API
If you have no idea how to implement this, you can also use my API catalogue based on Arcturus Morningstar.
If you gonna use this, be aware that this is only shows the Morningstar catalogue with currencys (0,5,103).
You must be registered for see links
@param [catalog_pages:id, [catalog_pages:id] .. (you can add as many as you want by adding a *).
Source
I'm using a QueryBuilder so you need to change the queries to get this working.
If you need some help ask me.
PHP:
<?php
new Querybuilder;
class Value
{
public static $allItems = array();
public static $allSubItems = array();
/** Indexing my currencys */
const currencys = array('duckets' => 0, 'diamonds' => 5, 'belcredits' => 103);
public static function ifSubpageExists($id)
{
return QueryBuilder::table('catalog_pages')->select('id')->where('parent_id, $id)->first();
}
public static function getCatalogItemsByParentId($id)
{
return QueryBuilder::query("SELECT id from catalog_pages WHERE parent_id IN ($id)")->get();
}
public static function getAllCatalogItems($page_id)
{
return QueryBuilder::query("SELECT DISTINCT catalog_items.*, (SELECT COUNT(*) FROM items WHERE item_id = catalog_items.id) AS amount FROM catalog_items WHERE page_id IN ($page_id)")->get();
}
public static function getValues($values)
{
/** Check if page has a subpage */
foreach($values as $page_id) {
(!empty(self::ifSubpageExists($page_id))) ? $subPage[] = $page_id : $page[] = $page_id;
}
/** Get all furni id's from page */
if(!empty($page)) {
self::$allItems = (self::getAllCatalogItems(join(',', array_map('intval', $page))));
}
/** If page has a subpage get item id's */
if(!empty($subPage)) {
$catalogSubpage = self::getCatalogItemsByParentId(join(',', array_map('intval', $subPage)));
}
/** Get all furni id's from subpage */
if(!empty($catalogSubpage)) {
foreach($catalogSubpage as $items) {
$item[] = $items->id;
}
self::$allSubItems = self::getAllCatalogItems(join(',', array_map('intval', $item)));
}
/** Merge if subpage exists otherwise return page */
$itemList = (!empty(self::$allSubItems)) ? array_merge_recursive(self::$allItems, self::$allSubItems) : self::$allItems;
/** Get related item data */
foreach($itemList as $item) {
$getCurrencys = array_flip(self::currencys);
if($item->cost_points > 0) {
$item->cost_points = ($item->points_type != 0) ? $item->cost_points . ' (' . ucfirst($getCurrencys[$item->points_type]) . ')' : null;
}
}
return $itemList;;
}
}
//* the numbers are the id from your catalog_pages
print_r(Value::getValues(array(69, 520)));
I will add this soon for AsteroidCMS>
You must be registered for see links
Thanks!
Raizer
Last edited: