Getting Product info in Element Block (Volusion) - volusion

I'm trying to create a custom block to add some info into a product page on the Volusion platform. I have looked through the documentation, but haven't managed to find anything conclusive.
Is there a way to get the product id/slug/name automagically upon page load?

On the productDetails.asp page (when you view a product), you have access to the productCode in JS via this variable global_Current_ProductCode.

Related

Regarding dynamically updating table view upon form submission

I'm using rails 4.2.7.1, ruby 2.3.1. I have a landing page containing an add button which upon clicking pops up a new window (in a new URL). This new window has a form in it. I want the landing page to have a table which is dynamically populated every time the form on the pop-up is submitted (basically re-direct back to the landing page and update the table).
We've an internal framework for creating HTML views as ruby objects (for instance, a table object or a panel object). These are created within the model class and have methods to enable their rendering (essentially use content_tag within the ActionView Helper to render the final HTML from .erb/HAML).
Now, the problem is the controller always ends up calling these methods in the model class every time the page is loaded. Due to this the objects aren't retaining their previous values. I got around this by using class variables but is there a better way to handle this? I haven't explored rails caching yet.
I'd be open to listening to solutions which don't follow the model described above.
Thanks
We've an internal framework for creating HTML views as ruby objects
(for instance, a table object or a panel object). These are created
within the model class and have methods to enable their rendering
(essentially use content_tag within the ActionView Helper to render
the final HTML from .erb/HAML).
I don't want to sound rude, but why? This seems like a huge over-complication and source of errors.
Anyway,
You'll want to look into Websockets. If you can upgrade to Rails 5, ActionCable might be the answer. Otherwise you could have the view update with a simple setInterval.

rails: remotely overwriting the value of an existing instance variable

Thanks for reading this.
I have an index view in my rails app. it has an area where i display a list of records. i use an instance variable called #list to hold the array of records. i have a couple of buttons on the form that remotely renders the list in either a grid or a list format. everything works great - i have a grid_partial and a list_partial, and i use JS to render whichever view the user clicks on.
i recently added a feature that allows the user to select the ordering criteria for the list (order by price: ascending, delivery date: descending, etc.). when they click on an ordering scheme, i ajax a method in the controller that updates the value of #list. the update method then calls a js.erb file that renders the partial. it does this correctly as the #list records are now in the order the user requested. My issue occurs when i click one of the buttons to switch between list and grid view. when i do this, the list and grid partials use the original, un-updated version of #list, NOT the value i most recently received from the last AJAX communication to the server. Both of my partials reference the #list instance variable to get the array.
It was my intent to be able to update/overwrite the value of #list, so that subsequent rendering of partials that reference #list would use the new, updated value. Is this possible?
I have tried to replace the #list variable with a local variable that is passed into each partial, but that doesn't fix the problem. Thanks in advance for your consideration.
Based on the limited information available I am guessing the controller that renders the list/grid partial on clicking the button is not aware of the altered ordering scheme.
you may consider either passing that information from the client as a query parameter, or save it in session.

Can't select page layout when creating a new page in Rails alchemy-cms

I'm new to alchemy-cms.
I created a fresh install from the guides. I did not add any concept or structure.
Going to localhost:3000 I have to add the first user and after that I have a clean site.
When trying to add a new page, I have to select a type (page-layout?) and type in a name.
The Type combobox remains empty, and therefore the website don't allow me to add a page. What am I doing wrong? I think I'm missing something very obvious here.
I have looked allready in the source code, and running the following:
rails console
Alchemy::PageLayout.all
and this results in:
=> [{"name"=>"index", "unique"=>true, "elements"=>["article"], "autogenerate"=>["article"]}]
So I would guess the combobox should be filled with this item.
The index page layout is marked as unique, so it can only be added once per language. And as the so called language root page (the first most page in your page tree) already has this page layout, no new page can be created using this page layout.
In order to fix your problem you need to add another page layout to your page_layouts.yml file. It is good practice to add an standard page layout that is not unique (default) and can therefore be added multiple times per language.

how to set navigate url to hyperlink through c#

am developing an application in which i have to show the customer purchase details supplier wise. for that i have develop user control an add it on page. but the problem it that on user control i need to add a ling to promotional offer page for that supplier which show the current offers of the supplier. for that i have added the hyperlink as fallow to user control
<asp:HyperLink ID="PromoLink" runat="server">Have promo Code ?</asp:HyperLink>
and set the navigation URL as fallow
PromoLink.NavigateUrl = "Promotion.aspx?Filter=" + dt.Rows[0]["SuppId"].ToString();
but when page is load in does not render the navigation url to the link.
i donot why it does not render the url plz help to get out of this.
thanks in advance.
Make sure that the pathing is correct for the NavigateURL property. Try adding "~/" at the start of the NavigateURL or "../" if it is not in the same folder as the current file.
Make sure that the dt.Rows[0]["SuppId"] is actually getting the value that you expect.
Step through code in the debugger to verify that the Page_Load event that you are using is actually executing and modifying the value as you would expect it to.

How to set an initial value for my object in ruby on rails

I am still pretty new to Rails and am working on a basic app and have run into a problem, which I can't seem to get around, sorry if this question has already been answered, but searching didn't yield me any results.
Basically I am creating an app that catalogues all of someones's clothes, Now the main page is the index page of everything they have logged, and each picture is linked to the show page where more information is revealed. I want to use AJAX to bring that show page to the side of the main index page. I am working off of another tutorial to figure this out but have run into a problem. On the initial load of my index page, I need to define a variable for that show page so that it can be rendered using a partial, but I can't use find(params[:id]) since the user hasn't selected anything yet. So my question is how do I set that initial value to either just the first item in the catalogue or not have anything appear, and then when someone does click the link, the sidebar shows the more detailed description of the piece of clothing.
Thanks for any help.
#object = params[:id] ? MyModel.find(params[:id]) : MyModel.first
But I think there's some problem with design of application.
You might have some luck working with the ruby gem 'PJAX'. Here is a screen cast showing you how to get that AJAX sidebar you want. Good luck
It sounds like you can just print the container element as normal, but leave it empty when the page is generated. Optionally, hide it via CSS. Then, when you load its content with AJAX, set it to visible or just populate it as normal.
Alternatively, if you really want to set it to the first item in the catalog (or in any ActiveRecord) you can use .first e.g. Products.first, and use that value to populate its initial contents.

Resources