a shop is quite easy, depending on your needs thoughā¦
the very easiest scenario is having a subpage filled with fields for price, product name, descriptions etc. and according to the informations given you can generate a paypal button. as thereās the option for success url etc. you can simply add a thankyou page.
for more advanced mechism you can include paypals IPN, or use another payment processor such as saferpay ( from sixpayments (more used in switzerland)).
if you have started with something like that you can always iterate to better versions of your own shop such as including sessions for having a cart-like system.
if you were not to use a payment processor, you could just send the informations via email or save it in a file.
edit:
with having unlockable content when purchasing, you might want to rely on a payment processor though.
thereās predefined functions for login/logout etc. and your products can be saved in a user account file ( /site/account/userfile.php )
you can call those saved variables simply by $user->field() and provide the download link. ( downloads are blocked by htaccess by default for example )
Very Basic example: Listing all purchases by the userfield āprodukteā
<?php $produkte = str::split($user->produkte(), ',') ?>
<?php if(count($produkte) == "0"): ?>
<tr><td>Keine digitale Produkte erworben</td></tr>
<?php endif ?>
<?php foreach($produkte as $produkt):?>
<tr>
<th><?php echo $pages->find('produkte/'.$produkt)->title() ?></th> <th><a href="<?php echo $pages->find('produkte/'.$produkt)->url() ?>/p:download"> Download </a></th>
</tr>
<?php endforeach ?>
When accessing the file thereās a mechanism to check if the download is really available on the logged in user:
<?php if($user = $site->user()): ?>
<?php if(param('p') == 'download'): ?>
<?php $produkte = str::split($user->produkte(), ',') ?>
<?php foreach($produkte as $download): ?>
<?php if($download == $page->uid()):?>
<?php $file= $page->file('produkt.zip');
ā¦
ā¦