Forum
Importing Data into Collections
Hi All ,
I am absolutely new to perch runway . Right now i have a CRM which has listings of real estates . This CRM can output data as an XML .
<Listing><count>1</count><Ad_Type>Rent</Ad_Type><Unit_Type>Warehouse</Unit_Type><Unit_Model>Covered Shed</Unit_Model><Primary_View>Asphalted Road</Primary_View><Unit_Builtup_Area>2939.00</Unit_Builtup_Area><No_of_Bathroom/><Property_Title>Direct From the Owner Brand New Warehouse for Rent </Property_Title><Web_Remarks><ul><li>Rate /Sq.ft : 23-27 AED .</li><li>Area: 3,000 to 53,000 sq. ft.</li><li>Utilities & Sewerage: To be borne by Tenant.</li><li>Power connection:3 Phaseand Single Phase (4500 - 7000 watt).</li><li>Renewal Terms: 3 year fixed rate contract & annual renewal thereafter.</li><li>Payment Terms: (4) Chqs in Favor of (Emirates for Industrial Cities Co.).</li><li>10 % Deposit Dated starting of the Contract + 2 Months Guarantee: Open Dated Chq.</li><li>Service Charges: Related to maintenance & Garbage removal etc. is borne by ECIC.</li><li>All warehouses insured by the owner, warehouses contents to be insured by the tenant.</li><li>No commission; No annual Admin fees; fixed rate for next 3 years.</li><li>Documents Required: Valid T.L, Bank Statement, partners Passport Copy & Emirates ID, main office tenancy contract.</li><li>Warehouses subjected to Sharjah Emirate Authorities (Economic Dept; Sharjah Municipality; SEWA; Civil Defense).</li><li>NOCs ready upon request free of charge for Decore and modification inside Warehouses i.e (Racking System; offices; increasing electricity load; adding Exhuast fans; etc ).</li><li>All waerhouses provided with the latest standards of civil Defense & firefighting system i.e ( sprinklers; smoke & heat detectors; Fire hose; diesel & electrical pump connected by Etisalat to the civil defense department. Water Lines & Fittings,Doors, Electrical Fittings & Lightings,Floor Base,Painting Internal & External,Emergency Door & Toilet Keys.</li></ul> <br /> PROPERTY FEATURES: <br />-24 hours Maintenance <br />-Bank/ATM Facility <br />-Bus services <br />-Business Center <br />-Mosque</Web_Remarks><Emirate>Sharjah</Emirate><Community>Al Sajaa</Community><Exclusive>1</Exclusive><Cheques>4</Cheques><Plot_Area>0</Plot_Area><Property_Name>Emirates Industrial City</Property_Name><Property_Ref_No>EMT-R-1002</Property_Ref_No><Listing_Agent>Muhannad Ahmed</Listing_Agent><Listing_Agent_Phone>0544588988</Listing_Agent_Phone><Listing_Date>2018-08-14 11:59:17 am</Listing_Date><Last_Updated>2018-11-11 2:54:28 pm</Last_Updated><Bedrooms>ST</Bedrooms><Listing_Agent_Email>muhannad.d@ei-city.net</Listing_Agent_Email><Price>70536</Price><Frequency>per year</Frequency><Unit_Reference_No>EMT-R-1002</Unit_Reference_No><No_of_Rooms>ST</No_of_Rooms><Latitude>25.3073140</Latitude><Longitude>55.6037920</Longitude><unit_measure>Sq.Ft.</unit_measure><Featured>1</Featured><Fitted>Semi-Fitted</Fitted><Images><image>https://watermark.propspace.com/watermark?c_id=3158&l_id=1576257625901031&aid=1470166&id=15342311358342284&wmt=1533213441&image=14_08_2018-12_17_46-3158-134b116ecafd3f6eb5dba00611961025.jpeg</image><image>https://watermark.propspace.com/watermark?c_id=3158&l_id=1576257625901031&aid=1470166&id=15342311358342284&wmt=1533213441&image=14_08_2018-12_17_46-3158-ea71f17b3c0e0ac0a2328028b52deec9.jpeg</image><image>https://watermark.propspace.com/watermark?c_id=3158&l_id=1576257625901031&aid=1470166&id=15342311358342284&wmt=1533213441&image=14_08_2018-12_17_46-3158-60a5abb8cb864d2add5a5957497c82e4.jpeg</image><image>https://watermark.propspace.com/watermark?c_id=3158&l_id=1576257625901031&aid=1470166&id=15342311358342284&wmt=1533213441&image=14_08_2018-12_17_46-3158-34385b9b1f5ef8a86fc22343b982f552.jpeg</image><image>https://watermark.propspace.com/watermark?c_id=3158&l_id=1576257625901031&aid=1470166&id=15342311358342284&wmt=1533213441&image=14_08_2018-12_17_46-3158-b1915f35db7bd917166f76e18f2b63a4.jpeg</image><image>https://watermark.propspace.com/watermark?c_id=3158&l_id=1576257625901031&aid=1470166&id=15342311358342284&wmt=1533213441&image=14_08_2018-12_17_46-3158-abc2a54be77025f009eac20dcb9ee46d.jpeg</image><image>https://watermark.propspace.com/watermark?c_id=3158&l_id=1576257625901031&aid=1470166&id=15342311358342284&wmt=1533213441&image=14_08_2018-12_17_46-3158-ba62449ef1932475a9e0893b83c2e013.jpeg</image></Images><Facilities><facility>24 hours Maintenance</facility><facility>Bank/ATM Facility</facility><facility>Bus services</facility><facility>Business Center</facility><facility>Mosque</facility></Facilities><company_name>Emirates Industrial City</company_name><Web_Tour>https://youtu.be/_92oK5-odbk</Web_Tour><Threesixty_Tour/><Audio_Tour/><Virtual_Tour/><QR_Code/><company_logo>https://crm.propspace.com/application/views/pictures/logos/31581533213435.png</company_logo><Parking>3</Parking><Strno/><PreviewLink>https://crm.propspace.com/preview/index/15342311358342284/3158/?l_id=1576257625901031</PreviewLink><price_on_application>No</price_on_application><off_plan>0</off_plan><permit_number/><completion_status/></Listing>
I am trying to create a website which can do the below .
- Take the feed and store it as items in perch .
- Display the items as required based on html templates
I do understand that the import is only possible by collections . The only question here is do i treat <Listing> as one type of content and all that comes below as attributes of the content ?
Yes, that sounds sensible.
It will be better to take help from the technical team https://babasupport.org/windows/fix-windows-10-error-code-0x8024a105/ which will able to provide the best suggestion regarding this topic.
Just one question , can we perform a search on collections ?
Just one question , can we perform a search on collections ?
Yes. You can perform simple search within admin panel of collections.
No the search is for the users landing on the page . For eg lets say i have a collection of property listings . Is there a way the user( page visitor) can perform a search ( just like the one you see in an e-commerce website with filters ) ?
https://docs.grabaperch.com/functions/search/
Official apps also register themselves with search so their content will be included.
Search Functions Search is part of Perch Core functionality and enables you to add a simple text search to your site.
Search can only search content that has been added through Perch and not static pages that you have added. Official apps also register themselves with search so their content will be included.
Perch comes complete with an example search page in the root of the download folder called search.php.
Also in the Perch download is a template in perch/templates/search. This template has all of the search template fields in it, including paging and can be used as is or you can edit the mark-up as with any Perch template.
To get search working make sure you have the template in your site in perch/templates/search then visit search.php in your browser and search for things that appear in your content.
ALSO SEE:
perch_collection()
as you can formulate a filter based on search and out put the filtered response...Hi Robert ,
I tried writing a php script for importing the collections from the xml .
And my template was
unfortunately , i get the warning :
I could see that it is looping through the xml , but what did i do wrong here ? i can also see that the collections still has 0 items in it .
Hello Titus,
Your template path and namespace don't look right:
If your template is
/perch/templates/content/property.html
, then you would usePerfect , that helped out !
Just one last question , have a look at the below xml
how do i iterate through nested childrens ? for eg: here in images , there are multiple urls . how do i store them in collections ?
I tried the above it doesn't work out .
This is not a Perch-specific question. You need to look at how you parse your XML. If you expect
$propertylisting->image
to have children, you can iterate over it the same way you're iterating over$xml
:Do you only want to store the URLs? Or do you want to import the images as Perch Assets?
I need to import them as perch assets . Thanks a lot for the effort btw I'm kind of new into PHP .
I tried this out , but how do I input multiple images to one item ?
This is what confuses me .
Never mind , i found out a solutions for it . Do let me know if i can do something better .
Normally you would use a repeater:
But the API doesn't support importing content into repeaters at the moment; so you can't use repeaters for storing content.
To simplify things, I would import the URLs as text instead.
A workaround would be to store all the URLs in a single text field separated by a character (e.g.
;
).Add a text field to your template:
Modify your importer accordingly:
Then wherever you display the properties using
perch_collection()
use theeach
option to prepare the image URLs in an array so you can display them using a repeater:Then in your display template, you can display the images in a repeater:
p.s. don't add the repeater to the edit template. Only add it to templates you use for displaying the content on the site.