Page 1 of 1

Modify/create new template structure

Posted: 19 Aug 2016, 11:37
by brunojti
Hi,

In the docs you say
Extensions that depend on the core and contain PHP template files in the client/html/templates/ directory named the same as existing ones are used first. Only if no extension contain a appropriate PHP template, the default one from the core is used.
Well, in the ./ext folder, I see that you have by default ai-client-html extension. I am trying to create a new extension but creating a file with same path won't overwrite the html structure.
I've created a file located at

Code: Select all

./ext/my-ext/client/html/templates/commom/summary/detail-body-default.php
Is there any place where I am supposed to "register" which extension should be loaded?

Re: Modify/create new template structure

Posted: 19 Aug 2016, 19:54
by aimeos
No, you don't have to register new extensions in the ./ext/ directory.
I've created a new extension, added the same template in the ./client/html/templates/common/summery/ directory, modified that template and it worked out of the box.

Did you clear the cache (artisan aimeos:cache) or configured your Aimeos installation to use no content cache?

Re: Modify/create new template structure

Posted: 22 Aug 2016, 16:41
by brunojti

Code: Select all

./client/html/templates/common/summery/ 
You are considering the root as the extension root, right?

You spelled `summery`. Is this right?

Does yours installation has ai-client-html extension?

Re: Modify/create new template structure

Posted: 22 Aug 2016, 17:48
by aimeos
The full path relative to the Laravel base directory would be

Code: Select all

./ext/my-ext/client/html/templates/common/summary/detail-body-default.php
The "summery" was a misspelling of mine because I didn't copy the path but wrote it from my mind.

Yes, the ai-client-html extension is always installed. Otherwise, the templates won't be used anyway.

Can you please check if the manifest.php file of your extension contains this section:

Code: Select all

'custom' => array(
	// ...
	'client/html/templates' => array(
		'client/html/templates',
	),
	// ...
),
My guess is that you've created the wrong extension version for your Aimeos version (2015.x instead of 2016.x).

Re: Modify/create new template structure

Posted: 23 Aug 2016, 01:50
by brunojti
How can I check the extension version? and how can I be sure that I am downloading the latest version?
btw, do you know any repository that contains a store that used aimeos? This would a huge game changer for me now!

Thanks!

Re: Modify/create new template structure

Posted: 23 Aug 2016, 15:56
by aimeos
Create a new extension (https://aimeos.org/developer/extensions/) and make sure the chosen version is "Aimeos 2016.x extension". Copy the modified template to the same location and try again.

Also make sure that you've cleared the Aimeos content cache (./artisan aimeos:cache) or configured to use no cache (https://github.com/aimeos/aimeos-laravel#hints).

We don't know any public implementation besides the Aimeos demo you get when installing the Aimeos Laravel package like described in the docs.

Re: Modify/create new template structure

Posted: 23 Aug 2016, 17:35
by brunojti
Reinstalled the whole thing an now it is working... I'm still getting used to the architecture but I'm evolving! :D
Thank you!

Re: Modify/create new template structure

Posted: 24 Aug 2016, 14:53
by brunojti
I need to add some custom JS to payment step on checkout process.

I tried to:

Code: Select all

<?php $this->block()->start('checkout/standard/payment'); ?>
<script type="text/javascript">
    var sender_hash = '';
    window.onload = function () {
        console.log("Setting session ID to: <?php echo $session_id; ?>");
        PagSeguroDirectPayment.setSessionId("<?php echo $session_id; ?>");
        console.log("Getting hash");
        sender_hash = PagSeguroDirectPayment.getSenderHash();
        console.log(sender_hash);
    };
</script>
<?php $this->block()->stop(); ?>
But the `sender_hash` variable is set to undefined. When I run the same command via chrome's console I get the valid response.

I need to add this code "later" to make it work, I just don't know how to do it. Can you help me?

Re: Modify/create new template structure

Posted: 25 Aug 2016, 10:41
by aimeos
The first thing is to add your JS code to the payment-header-default.php file and not to the HTML body. Then you should check what getSenderHash() does so you know what must be available in the URL/environment/etc.