X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Moving price on product page (https://forum.x-cart.com/showthread.php?t=77938)

ilclark 08-01-2020 05:06 PM

Moving price on product page
 
Hi all, I'd like to perform a small layout modification, just moving the price field above the product brief description field.

Hey X-Cart 5 has a template editor, this should be quick and easy!

I'm assuming it's me, initially great pretty intuitive, but then no, I can't just select drag and drop, why not? Now I get frustrated, can't seem to get my head around this. ](*,)

I read the template editor doco, why can't I get it to work in a similar way as the invoice example? Must be me but what am I doing wrong??

Anyone?

Thanks,
Iain

pauldodman 08-03-2020 02:36 AM

Re: Moving price on product page
 
Have you tried using the template editor and just moving the price code where you want it to be? ie cut and paste the code rather than trying drag and drop.

ilclark 08-04-2020 03:35 PM

Re: Moving price on product page
 
Hi Paul, I got it to work by creating a new template, cutting the code from the original position and pasting it into my new template.

Possibly the way to do it but it just felt less intuitive than being able to drag or renumber a section to a new spot?

Especially when on the layout editor you can drag and drop, albeit larger sections of functionality, ie I swapped Related Products and the Customers Also Bought sections quickly and easily.

cflsystems 08-04-2020 04:44 PM

Re: Moving price on product page
 
The drag and drop works only on individual sections or modules if you'd like but not within sections. It's basically helpful for large individual sections nothing else.

To move these templates on the page you should use the ListChild declaration and reassign its weight for the different templates within the same list. If they are within different lists you will have to reassign the list and the weight for the template you want to move.

ilclark 08-04-2020 07:41 PM

Re: Moving price on product page
 
1 Attachment(s)
It must be me, but not sure how to implement that, see attached of what I did to get it to at least work.

cflsystems 08-05-2020 04:00 AM

Re: Moving price on product page
 
You cannot do this from the template editor. You need to create new module and do it in there.
Reassign the template (move it) within a list of templates.
Unfortunately the XC documentation lacks howtos and explanations what's what big time. Your best help is existing code.


Here is an example from the CrispWhite theme


Code:

    protected static function moveTemplatesInLists()
    {
        $templates = [
            ........
            'layout/content/main.location.twig' => [
                static::TO_DELETE => [
                    ['layout.main', \XLite\Model\ViewList::INTERFACE_CUSTOMER],
                ],
                static::TO_ADD    => [
                    ['center.top', 1000, \XLite\Model\ViewList::INTERFACE_CUSTOMER],
                ],
            ],
            ........
        ];
    }



Moving the main.location.twig template from "layout.main" list to "center.top" list and giving it weight of 1000.
So you need to find the list the template you want to move belongs to and the list you want to move it to - in your case "product.details.page.info"


Code:

    protected static function moveTemplatesInLists()
    {
        $templates = [
            'TEMPLATE YOU WANT TO MOVE - PATH RELATIVE TO SKINS/CUSTOMER/' => [
                static::TO_DELETE => [
                    ['product.details.page.info', \XLite\Model\ViewList::INTERFACE_CUSTOMER],
                ],
                static::TO_ADD    => [
                    ['product.details.page.info', 99, \XLite\Model\ViewList::INTERFACE_CUSTOMER],
                ],
            ],
        ];
    }


This goes in your_module_root/Main.php
I don't think you can do this with the templates modified through the template editor though.


All times are GMT -8. The time now is 06:52 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.