• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

AAC Znote Shop: How to let players choose the amount of items they will buy?

gavizera

New Member
Joined
May 19, 2020
Messages
20
Reaction score
2
So, I'm creating my server store ... The question is very simple, how to program Znote so that players can select the amount of "items" they want to buy (instead of buying one by one), at moment, if they want to buy 100 crystal coins, they have to click 100 times in "Purchase", as seen below! LoL

And in config.php, we have this:
Lua:
    $config['shop_offers'] = array(
        1 => array(
            'type' => 1,
            'itemid' => 2160, // item to get in-game
            'count' => 1, // Stack number (10x itemid)
            'description' => "10k, 1 crystal coin.", // Description shown on website
            'points' => 1, // How many points this offer costs
        ),

(And yes, I'm pretty bad at programming... 😂)
 

Attachments

Solution
This requires quite a substantial change in the code, every form element requires an extra input (that lets users choose order-multiply factor) Znote/ZnoteAAC (https://github.com/Znote/ZnoteAAC/blob/26628602b2a9407997d9b2eee55fd8dce1876aa1/shop.php#L300-L304)

And there should be javascript involved that updates the row accordingly to display the new count and price before the user clicks on purchase.

When the user click on purchase, the data that is being sent to processing the order is the offerid (key of the order element from config.php), and the multiply factor.

The processing order code is here:

Line 30 looks like a...
in "'count' => 1", you choose the amount of items

PHP:
    $config['shop_offers'] = array(
        1 => array(
            'type' => 1,
            'itemid' => 2160, // item to get in-game
            'count' => 100, // Stack number (10x itemid)
            'description' => "10k, 1 crystal coin.", // Description shown on website
            'points' => 1, // How many points this offer costs
        ),
I'm guessing he means to be able to choose as a player how much money they want to buy
 
I'm guessing he means to be able to choose as a player how much money they want to buy

That's right! Currently, as the screenshoot shows, the player can only buy the pre-determined amount of crystal coins (for example), I was wondering if there is any change in the code that allows the player to choose how many crystal coins to buy...
(sorry my bad english! xD )
 
This requires quite a substantial change in the code, every form element requires an extra input (that lets users choose order-multiply factor) Znote/ZnoteAAC (https://github.com/Znote/ZnoteAAC/blob/26628602b2a9407997d9b2eee55fd8dce1876aa1/shop.php#L300-L304)

And there should be javascript involved that updates the row accordingly to display the new count and price before the user clicks on purchase.

When the user click on purchase, the data that is being sent to processing the order is the offerid (key of the order element from config.php), and the multiply factor.

The processing order code is here:

Line 30 looks like a sensible place to add the modification to the processing code, where you multiply required points in $buy['points'] and $buy['count'] according to configured multiply factor.
 
Solution
Back
Top