Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Releases
[Arcturus] Automatic exchange values
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Raizer" data-source="post: 455540" data-attributes="member: 84739"><p>Hi Devbest members,</p><p></p><p>Tonight I was busy making something for my CMS and that is that you can easily create an exchange-value page without any difficulty.</p><p>You can find my live example here: <a href="https://asteroidcms.nl/exchange" target="_blank">https://asteroidcms.nl/</a>marketplace</p><p></p><p>I can add catalog_pages in my housekeeping value manager which i want to use under my exchange value category.</p><p>(Pages is just a field in with arrays)</p><p></p><p>[CODE]</p><p>INSERT INTO `website_rare_values` VALUES (1, 'catalogue-rares', 'Catalogue Rares', '[348, 327]', '0');</p><p>INSERT INTO `website_rare_values` VALUES (5, 'limited-edition', 'Limited Edition', '[520, 311]', '0');[/CODE]</p><p></p><p><img src="https://image.prntscr.com/image/rhaj09x-Sui4inh4E8c3EA.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p>You can change the value of the items when you click on the edit button</p><p>In my housekeeping it look like this: <a href="https://gyazo.com/2416d67ae866026b048104575b92bea7" target="_blank">https://gyazo.com/2416d67ae866026b048104575b92bea7</a></p><p></p><p>When you change the value, the rate will automatically adjust (up/down).</p><p></p><p><strong>Important</strong></p><p>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.</p><p></p><p><strong>API</strong></p><p>If you have no idea how to implement this, you can also use my API catalogue based on Arcturus Morningstar.</p><p>If you gonna use this, be aware that this is only shows the Morningstar catalogue with currencys (0,5,103).</p><p></p><p><a href="https://asteroidcms.nl/value/69*520" target="_blank">https://asteroidcms.nl/value/69*520</a></p><p>@param [catalog_pages:id, [catalog_pages:id] .. (you can add as many as you want by adding a *).</p><p></p><p><strong>Source</strong></p><p>I'm using a QueryBuilder so you need to change the queries to get this working.</p><p>If you need some help ask me.</p><p></p><p>[CODE=php]</p><p><?php</p><p>new Querybuilder;</p><p></p><p>class Value</p><p>{</p><p> public static $allItems = array();</p><p> public static $allSubItems = array();</p><p></p><p> /** Indexing my currencys */</p><p></p><p> const currencys = array('duckets' => 0, 'diamonds' => 5, 'belcredits' => 103);</p><p></p><p> public static function ifSubpageExists($id)</p><p> {</p><p> return QueryBuilder::table('catalog_pages')->select('id')->where('parent_id, $id)->first();</p><p> }</p><p></p><p> public static function getCatalogItemsByParentId($id)</p><p> {</p><p> return QueryBuilder::query("SELECT id from catalog_pages WHERE parent_id IN ($id)")->get();</p><p> }</p><p></p><p> public static function getAllCatalogItems($page_id)</p><p> {</p><p> 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();</p><p> }</p><p></p><p> public static function getValues($values)</p><p> {</p><p> /** Check if page has a subpage */</p><p></p><p> foreach($values as $page_id) {</p><p> (!empty(self::ifSubpageExists($page_id))) ? $subPage[] = $page_id : $page[] = $page_id;</p><p> }</p><p></p><p> /** Get all furni id's from page */</p><p></p><p> if(!empty($page)) {</p><p> self::$allItems = (self::getAllCatalogItems(join(',', array_map('intval', $page))));</p><p> }</p><p></p><p> /** If page has a subpage get item id's */</p><p></p><p> if(!empty($subPage)) {</p><p> $catalogSubpage = self::getCatalogItemsByParentId(join(',', array_map('intval', $subPage)));</p><p> }</p><p></p><p> /** Get all furni id's from subpage */</p><p></p><p> if(!empty($catalogSubpage)) {</p><p> foreach($catalogSubpage as $items) {</p><p> $item[] = $items->id;</p><p> }</p><p> self::$allSubItems = self::getAllCatalogItems(join(',', array_map('intval', $item)));</p><p> }</p><p></p><p> /** Merge if subpage exists otherwise return page */</p><p></p><p> $itemList = (!empty(self::$allSubItems)) ? array_merge_recursive(self::$allItems, self::$allSubItems) : self::$allItems;</p><p></p><p> /** Get related item data */</p><p></p><p> foreach($itemList as $item) {</p><p> $getCurrencys = array_flip(self::currencys);</p><p></p><p> if($item->cost_points > 0) {</p><p> $item->cost_points = ($item->points_type != 0) ? $item->cost_points . ' (' . ucfirst($getCurrencys[$item->points_type]) . ')' : null;</p><p> }</p><p> }</p><p> return $itemList;;</p><p> }</p><p>}</p><p></p><p>//* the numbers are the id from your catalog_pages</p><p>print_r(Value::getValues(array(69, 520)));</p><p></p><p>[/CODE]</p><p></p><p><strong>I will add this soon for AsteroidCMS></strong></p><p><strong><a href="http://asteroidproject.nl" target="_blank">http://asteroidproject.nl</a></strong></p><p></p><p>Thanks!</p><p>Raizer</p></blockquote><p></p>
[QUOTE="Raizer, post: 455540, member: 84739"] 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: [URL='https://asteroidcms.nl/exchange']https://asteroidcms.nl/[/URL]marketplace 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) [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');[/CODE] [IMG]https://image.prntscr.com/image/rhaj09x-Sui4inh4E8c3EA.png[/IMG] You can change the value of the items when you click on the edit button In my housekeeping it look like this: [URL]https://gyazo.com/2416d67ae866026b048104575b92bea7[/URL] When you change the value, the rate will automatically adjust (up/down). [B]Important[/B] 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. [B]API[/B] 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). [URL]https://asteroidcms.nl/value/69*520[/URL] @param [catalog_pages:id, [catalog_pages:id] .. (you can add as many as you want by adding a *). [B]Source[/B] I'm using a QueryBuilder so you need to change the queries to get this working. If you need some help ask me. [CODE=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))); [/CODE] [B]I will add this soon for AsteroidCMS> [URL]http://asteroidproject.nl[/URL][/B] Thanks! Raizer [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
[Arcturus] Automatic exchange values
Top