I have a list of customer names. On scrolling to end of page I load the next page. Now on this same page there is an option to create a new customer. So I create a customer and add this customer in the already present list. Now after creating a new customer, when I scroll down, the next fetched page contains some customers which are already present on my front end.
My question is regarding spring data rest. Does spring data rest offers offset field in url? For example:
/api/users?sort=userId,desc&size=20&page=1&offset=5
Related
In Eloqua, can you send out an email to a contact list but version the "hero" image headline for each segment using dynamic content blocks?
And then can you do the reverse, have the main image remain the same, and dynamically populate products below that they've purchased in the past?
For scenario 1, yes that is possible out of the box.
Scenario 2 however is a bit more complicated and would generally require a 3rd party tool to provide this type of dynamic code generation based upon a lookup table (in this case a line item inventory or purchases). Because a contact could have zero or more products (commonly as individual records in a CDO), you would generally need to aggregate or count the number of related records, and then generate your HTML table and formatting around those record values, and be contextually aware if it is the first or last record (to begin and close the table). Dynamic content does not have mathematical functions and would not be able to count those related records - this is something usually provided by a B2C system like SFMC using ampscript or dynamically generated through custom code and sent through a transactional SMTP service. You could have multiple dynamic content on top of each other, but your biggest limitation becomes the field merge, with only lets you select a record based upon earliest/last creation date, or last modified. This is not suitable if you have more than 2 records. A third party service that provides a cloud content module for your email is your best bet.
Anyone know if it's possible to retrieve the customer name related to a transaction from the API?
I see it under "Paid by" if I follow the "payment_url" in the connect v1 https://connect.squareup.com/v1/{{location_id}}/payments/{{payment_id}} endpoint but can't see to find it anywhere else
Background: I'm working on a ticketing system that breaks out items by item_category so a kitchen gets only food items and the bar gets only drink items.
I have queues and itemized tickets by category BUT I can't seem to find the customer's name anywhere
You'll need to utilize the V2 Transactions API. When you call ListTransactions or RetrieveTransaction (ListTransactions), the Transaction object will have an array of Tenders, tenders, which has a field called customer_id. With this id, you will be able to pass it to RetrieveCustomer (RetrieveCustomer) to find out their name. Note that if you're not explicitly filling out their name, the name might not be available (an "instant profile" (Instant Profiles) will be created with whatever information can be retrieve from the card used to pay).
Update: Alternatively, as suggested by #Dan, would be to strip the payment_url from a V1 RetrievePayment (RetrievePayment) which includes the transaction_id at the end of the URL: https://squareup.com/dashboard/sales/transactions/TRANSACTION_ID. This is more efficient as you won't need to loop through transactions, and allow you to send it straight to RetrieveTransaction.
I'm trying to get variable number of records per page in Yii. The page size is dependent on the number of records that match a criteria, so It has to be changed on every AJAX request sent by Yii's pagination.
Here's a sketch of the exact problem:
Table Structure [pk, user_id, entry_date, entry_message]
The view has a CGridView with pagination enabled and pageSize set to 10. What I want to do is to show the entries from one date on one page. For example, page one should show the entries from today. Page two should show the entries from yesterday. So I presume that the limit and the offset should be variable, but I can't quiet understand how to change them.
I have a block that displays the number of clicks on the page it is installed.
I want to display that block on every page.
I have tried creating a stack and then including that stack into a global area. The problem is that when the stack is included it includes the same block on every page.
So instead of having different blocks on every page, I have the same block on every page. That results in counting the clicks on all pages instead of only the current one.
How can I include a block on every page, but each having an unique ID as it has when added manually?
Thanks.
There's no way to have a unique block on every page without adding it manually. Even if you make it a "page type default", you'll end up with a shared block ID until you make the first edit (at which point it'll get it's own ID). And if you hardcode into the page's PHP code, it won't have a block ID at all.
With that being said, I don't know why you need a unique block ID. Obviously, each page is going to have a unique ID. So your block should be able to store clicks (I'm not sure exactly what you mean here, but it's probably irrelevant) against the page ID (collection ID in c5 parlance), and retrieve it against that, too.
Edit:
Considering your comment, and based on my understanding of what you're trying to do, there's no reason why you can't combine the block ID (which will, as you say, be duplicated across pages, but will be different on each block ON a page) and the page ID. So if you place two blocks in a stack, they'll get IDs 1 and 2. They'll have IDs 1 and 2 on every page the stack is own. So when you're trying to "record" whatever data they product, you combine the bID with the cID to get 1-103 and 2-103, and 1-4719, etc.
Edit 2:
So if your difficulty isn't so much "keying" the data, but physically storing the data, then see jordanlev's comment below. You won't be using the $btTable table as that's keyed off the bID. Instead you'll use db.xml to create a new table which can take your new key, and whatever other data you want to store. It's then your responsibility to query and update it with Loader::db(). See his block, or see the core's "survey" block for examples of how to manage your own db table.
Situation:
Let say we have a list of products and each with a bunch of orders. I have a my index view that has this list of products contained in the model. I iterate over the list and display a list of products on the page. I add an jquery click event for each project, the click event loads a partial view for each order beneith the product list.
Order partial view would look like this:
#model Order
<p>#Model.orderNum</p>
#Html.DropDownListFor(Order.CustomerName,CustomerNameList)
<input type="submit"/>
Index view would look like this:
#model List<Products>
#foreach(Product p in #Model)
{<button class="product-button">#p.productId</button>}
<div id="orderDiv"/>
then I would execute the following javascript for every order for the product:
$("#orderDiv").append($("<div></div>).load("MyController/Order/[order ID would go here]"));
This would load an order with a seperate partial view for each order id the product had.
Problem:
The simple solution would be to have the CustomerNameList in the Order Model. However, I don't want to load that data to the page so many times. Is there a way I can put it in the ViewBag or store it somewhere else so this list is available to the whole page?
Notes:
I don't want to use one partial view for all of the orders (ie. have the order view model be a list and iterate over it in the partial view) because I want to be able to submit each order individually (to save it)
I also might need to use this list of Customers on some other part of my page. I would like to keep it available. For example maybe I have a button that says new order and this uses ajax to load a parital view and that partial view also needs the customer list. I don't want to send that data to the page so manye times.
Can I do this?
Is this just a bad way to do this?
Not too sure why you would want to load a dropdown list of users, for already, existing orders. That means you are wanting the facility to change WHO made the order?
However, if you must, you can load your customer dropdown list as an empty dropdown with a class of customer, you can then make an internal call to get the json for customer, and then load up all your instances of class customer, with the data from your json call of customer data.
This would allow you to have 50 orders listed, with one single collection of customers data.
personally though, you should have relationships with your models using foreign keys, or using a viewmodel that would already add in your customers list, you would also only wish to show full order details to a user, if they clicked on the row to show full details.
Even if someone goes mental on the screen and clicks all 50 to look at, you should still be able to handle these request without much trouble, otherwise and likewise you wont be able to have 50 customers all looking at there baskets at the same time, or 50 customers all searching the products database at once!