Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hi Team,

We are building a Reservation Booking Section for a Holiday House, and we have come across a couple of little problems that hopefully someone on here can help with.

Part 1.
We have setup the CSV Importer (Which works amazingly) and we are importing a daily CSV from VBRO (holiday house booking site), the only problem is that a couple of the CSV Column Titles have spaces in them? and when I try to bring them into the importer as the following
Code: Select all
reservation_id    = _Reservation ID

It doesn't work, as I am assuming it doesn't like spaces. I can manually change the column headings but that kind of defeats the automation purpose.
I have tried adding stops, and HTML spaces, and putting them in brackets and nothing seems to work. Hopefully someone has a better idea than me. :)

Code: Select all
<!-- database operation here -->
                <!-- set the following two variables to match your use-case -->
                    <cms:set my_template_name = 'reservations.php' />
                    <cms:set my_page_title = "<cms:show _Reservation ID/>" />

                    <!-- 1. convert the title into unique page_name -->
                        global $CTX, $FUNCS;
                        $name = $FUNCS->get_clean_url( "<cms:show my_page_title />" );
                        $CTX->set( 'my_page_name', $name );

                    <!-- 2. try to find a page by the name generated above -->
                    <cms:set my_page_id = '' 'global' />
                    <cms:pages masterpage=my_template_name page_name=my_page_name limit='1' show_future_entries='1'>
                        <cms:set my_page_id=k_page_id  'global' />

                    <!-- 3. if 'my_page_id' is empty at this point, the page does not exist - so safe to create one now -->
                    <cms:if my_page_id=''>

                        <!-- CREATE HERE -->
                        _auto_title       = '1'
                        _invalidate_cache = '0'
                        _masterpage       = 'reservations.php'
                        _mode             = 'create'

                        k_page_title      = "<cms:show _Reservation ID/>"

                        reservation_id    = _Reservation ID
                        created_on        = _Created on
                        email_address     = _Enquiry
                        customer_name     = _Enquirer
                        phone_number      = _Phone
                        check_in          = _Check-in
                        check_out         = _Check-out
                        adults            = _Adults
                        children          = _Children
                        booking_status    = _Status
                        booking_source    = _Source
                        <cms:if k_error>
                            <strong style="color:red;">ERROR:</strong> <cms:show k_error/>


                <!-- end database operation -->

Part 2.
The second part is not so much a big deal, as I think I have found a workaround, but is there was a way to import a date into the csv importer as it keeps throwing errors when I use <cms:date> and type=datetime

Hope that makes sense. I look forward to hearing any thoughts.



Yes, you are correct - spaces in variable names need special treatment.
Please try the following -
Code: Select all
k_page_title      = "<cms:get '_Reservation ID' />"
reservation_id    = "<cms:get '_Reservation ID' />"

Hope this helps.
Do let us know.
Brilliant. Thank-you so much KK that worked perfectly.
You are welcome :) Glad it helped.
4 posts Page 1 of 1