Pyrocms Getting Values at front end - database

I am new to pyrocms.
How can I get database values on pages of pyrocms. In website of pyrocms I had created a listing page now I want to display database values from pyro database table.

I got your question, you want to create a listing on your front-end page for some database table values which you want to access through your custom module controller. there are many ways to get these values but the simplest way is to use ajax. you already have Jquery added in pyrocms so you can simply make a call to your controller method in ajax and get your required output as HTML and display it in the div element on your page.
$.ajax({
type:"POST",
url:"admin/your-controller-name/your-method-name",
success:function(html){
$('yourdiv').html(html);
}
})
In your controller create a method which get data from database and print it using echo create some listing table etc what you want.
i think you will get my point. if confuse then get back to me

You need to be more specific as PyroCMS has lots of components and each module (blogs, variables, widgets, file uploads etc.) uses specific tags you insert into the page. You may come across references to 'Lex' - that's the name of the parser used to display them.
Tags documentation
PyroCMS (the Professional edition) also has a feature called "Streams" which allows you to build custom databases and this in turn has it's own series of tags.

Related

How can the category and product fields in Shopizer be customized, if possible at all?

I am currently using Shopizer as a sort of headless CMS, leveraging its out of the box admin pages and REST API for the content. There is a page for editing products in the admin system but I would like to add and/or remove specific fields. Making changes to the base code seems to be the most obvious solution but it is taking me a significant amount of time to implement it successfully.
Is there some sort of a config file or an initialization process to customize the fields for creating categories and products using Shopizer's admin page? What is the best practice for this scenario if the former approach is not possible?
If you need to add fields the easiest way is to add them in model objects
com.salesmanager.core.model.*
Example of an annotated field
#Column (name ="IP_ADDRESS")
private String ipAddress;
Once you restart your instance the new field will be available.

Apache Zeppelin: get built in table data in code

Apache Zeppelin 0.8.0 allow to modify data in cells in built-in table.
I assume new values are linked to some variable inside angular scope.
How can I find out what is the name of this variable, so I'd be able to read it in the next paragraph using zeppelin context:
z.angular("tableData??")
Is it possible to get all variables available in zeppelin context?
Any suggestions appreciated.
As for now I've found an indirect way of doing it. It's a bit tacky way, so I'm still looking for better solution.
In the example below I'm implementing simplified scenario, where I just need to remove selected lines.
There are few features I'm using:
Table grid allow to incorporate html into the cells.
%spark.sql
select product, price, '%html <input class="input_data" ... />' from table_a
Unfortunately it's impossible to use %angular inside table, so I've requested this feature: ZEPPELIN-3068
Using this feature we can add another column into the table with any html element (checkbox, input field or external link). I can use selected variables from table to generate unique ids.
It can even be a small form with POST request to web-service that will immediately perform requested changes.
Next paragraph will contain javascript that read data from html elements we've created above and store it in zeppelin context.
%angular
document.getElementsByClassName("input_data")
ps. if anyone need code, I can add full script.

SuiteCommerce Advanced - Show a custom record on the PDP

I am looking to create a feature whereby a User can download any available documents related to the item from a tab on the PDP.
So far I have created a custom record called Documentation (customrecord_documentation) containing the following fields:
Related item : custrecord_documentation_related_item
Type : custrecord_documentation_type
Document : custrecord_documentation_document
Description : custrecord_documentation_description
Related Item ID : custrecord_documentation_related_item_id
The functionality works fine on the backend of NetSuite where I can assign documents to an Inventory item. The stumbling block is trying to fetch the data to the front end of the SCA webstore.
Any help on the above would be much appreciated.
I've come at this a number of ways.
One way is to create a Suitelet that returns JSON of the document names and urls. The urls can be the real Netsuite urls or they can be the urls of your suitelet where you set up the suitelet to return the doc when accessed with action=doc&id=_docid_ query params.
Add a target <div id="relatedDocs"></div> to the item_details.tpl
In your ItemDetailsView's init_Plugins add
$.getJSON('app/site/hosting/scriptlet.nl...?action=availabledoc').
then(function(data){
var asHtml = format(data); //however you like
$("#relatedDocs").html(asHtml);
});
You can also go the whole module route. If you created a third party module DocsView then you would add DocsView as a child view to ItemDetailsView.
That's a little more involved so try the option above first to see if it fits your needs. The nice thing is you can just about ignore Backbone with this approach. You can make this a little more portable by using a service.ss instead of the suitelet. You can create your own ssp app for the function so you don't have to deal with SCAs url structure.
It's been a while, but you should be able to access the JSON data from within the related Backbone View class. From there, within the return context, output the value you're wanting to the PDP. Hopefully you're extending the original class and not overwriting / altering the core code :P.
The model associated with the PDP should hold all the JSON data you're looking for. Model.get('...') sort of syntax.
I'd recommend against Suitelets for this, as that's extra execution time, and is a bit slower.
I'm sure you know, but you need to set the documents to be available as public as well.
Hope this helps, thanks.

Recreate a form in CakePHP 1.3 from $this->data?

I've got a Cake application with a reports query interface, where the admin user can filter the data by various inputs in a form and the results are then displayed on the screen. I am looking for the simplest way to add a button which allows the user to download the results of this same query as CSV.
I'm sure I can create one for myself if I have to, but is there already a way to regenerate any given form based on $this->data? That way, I can just add .csv to the form action and use RequestHandler to choose the right output format.
[here take a look at the following...
instead of finding the data from Db you can simply pass $this->data to it.
take a look at follo
Exporting data to CSV the CakePHP way
I guess you have to replicate the function on your controller, one for generating the results on screen and another same function intended for csv, but on the function for csv it must have parameters which are similar to the values of $this->data. Use javascript to redirect on the function for csv.

Salesforce.com visualforce between 2 objects

In salesforce I need to create a visualforce page that includes the fields of 2 objects. The first object is the QUOTE object. The second objects is a custom object with several fields.
I want to create a visualforce page that shows the records of both QUOTE and the new object. Can I do this without creating a custom controller? If no any hints on the code for this new controller?
Can I do calculations between fields in a visualforce page?
Ideally I want this page to appear as soon as the QUOTE is set to ACCEPTED
1: You can't do this without a custom controller unfortunately, unless one object is related to the other and you're just happy displaying it as a related list on the parent object's page. For calculations you could use rollup summaries for some basic sums etc..
As for a custom controller, have a look at field sets for a super easy way to get fields into a VF page, you essentially configure groups of fields on your objects and then you can stick those groups onto a page with minimal markup.
2: For fields with complex calculations you'll want to do the sums in the controller and then expose the results through variables onto the page in the usual manner.
3: Not really possible without creating a custom edit page in the first place — you'd be better off having a button on the quote page to open up the Visualforce page, that page can simply display an error if the quote is not yet accepted. There are some other alternatives that might work though, like using a forumla field to generate a link to the page when the status is as you desire.
I'm happy to elaborate on any of this, but the fact that you're asking about number 2 would suggest to me that you don't have much experience developing on the platform (not a dig, just an observation), so unless you're comfortable coding in other environments you could find this quite tricky. That said, you're on stackoverflow so I'm thinking you probably know a little about coding at least!

Resources