Retrieve quote from other website in same installation - magento

I'm attempting what I thought would be simple but has turned complicated. Basically, I have two websites in one installation. I need to retrieve the current quote (guest or logged-in) from the opposite website.
The sessions are shared across both. Here's what I've tried so far:
Setting the current store to the opposite store briefly, grabbing cart and setting it back. This actually does work for wishlists but not quotes
Setting the opposite store in core/session and retrieving quote
Parsing core/session visitor data for ID I could use to do SQL query. There is a visitor_id but have not found the link between that and quote
Has anyone done this before? Seems like there should be a way to grab quote using sessionId with storeId but I haven't found it.
Thanks!

Argh, was looking in the wrong session namespace. Should have been checkout/session (obviously) instead of core/session. Will go ahead and answer it, in case someone else has same obstacle.
$ecommerce = Mage::getModel('core/store')->load('ecommerce_store_view');
$quoteId = Mage::getSingleton('checkout/session')->getData('quote_id_' . $ecommerce->getWebsiteId());

Related

Get Github Issue based only on title

I need to modify the body of an existing GitHub issue in a Project. All I'll be passed is the title of the issue, and a word (the word exists in the body, and I'll just need to fill the checkbox next it).
It looks like to do this I'll need to use the GET API to get the body of the issue, modify it, and then use the EDIT API to swap in the new body. However the GET API can only be called with the issue number. I need to do all this as quickly as possible. Is there some way to search via an API call?
Thoughts much appreciated!
Edit: All my issues are in the same project (and issue titles will be unique there). I've also recently discovered Github's GraphQL API, which may be applicable here.
You can use the issue search endpoint with the in and repo¹ keywords:
GET /search/issues?q=text+to+search+in:title+repo:some/repo
Of course, issue titles aren't guaranteed to be unique. You'll have to request each of the issues that comes back and see if its body contains the word you're looking for. Even in that case you could get multiple positive results.
It would be much better if you could search by issue number.
¹I've assumed that you really mean "repository" when you say "project". But if you're actually talking about GitHub Project Boards you can use the project keyword as well or instead.

Plone image visibility with one state workflow

I am using 'one state workflow' for image types in Plone, and it appears an anonymous user can still see an image even if it's 'publishing date' is set in the future...
Is 'publishing date' ignored in 'one state workflow' for images?
It also appears 'expiry date' is also ignored ie it appears when you dial up its url.
Note: I am accessing the image direct via it's URL eg my.site.com/assets/images/myexpiredimage
Perhaps these publish/expiry dates only useful for listings and collections etc, they dont control access and visibility?
Tried to find good Plone doco on this but couldn't... happy for a link to where this is explained?
Setting the publication- or expiration-date merely means the item will not show up in listings (navi-elements, search results, folder-listings), and is not to be confused with workflow-states.
A better solution would be to change the wf-state, when a date is met via a cron, which can be done quite comfortably with collective.contentrules.comingsoon.
Yet you need to rip out the default-behaviour of the concerned templates, I'm not sure, but maybe there is a proposal ("PLIP") already going on for this, if you find one, please leave the link here.
Refs: Control access on future content and How to retract content after expiration date
Yes, these things do nothing about people who have the URL, ever, regardless of workflow. The best quote for this I could find in three minutes is hidden in the user manual glossary.

adding tracking parameter is treating url as differnt

I am using Disqus for comments management.But the problem is its treating below link as different
http://gpuzzles.com/mind-teasers/logical-age-riddle/
http://gpuzzles.com/mind-teasers/logical-age-riddle/?source=tracking1
as a result comments in one post is not reflecting in other post.
Please suggest a solution
By default Disqus will identify a unique thread by its unique URL in the window. This is a very easy way to integrate, but isn't too reliable as you're seeing.
To prevent this you would want to pass a 'disqus_identifier' and/or a 'disqus_url' javascript variable. You can read about these here: http://help.disqus.com/customer/portal/articles/472098
That'll override looking at the window location for a unique identifier.

Should I use hashbang/shebang?

I read here that the idea of the shebang (#!) was so Google
knows that an alternative conventional
URL exists providing the same page
"state"
So, if I don't have conventional URLs corresponding to these hash-states, am I right to say that I should be using just a hash and not a shebang?
Background: The hashes are created based on a search form, and the search results are loaded on the same page. The hashes are there so that people can go back to the URL with the hashes and repeat the same search.
More broadly, is there a reason I should have real URLs corresponding to my hashes?
To be clear, is this a javascript powered site? As far as I'm concerned that would be the only reason that one might need to use a #!. With that said, even the #! can be full of issues, as could be seen for a while during the gawker switch earlier this year.

Codeigniter is "catching" url charcters even though they've been urlencoded

I'm having the strangest issue with codeigniter. I have a site that has a search feature which displays the person's query in the url so that they can save the url. I make sure that the query text has gone through rawurlencode before I stick it in the url. However, Codeigniter still shoots me to an error page when there's a character in the query that isn't in my permitted_uri_characters configuration.
So even though my browser says /search-results/query/%22samplequery%22, I’m still getting the error about using non-permitted characters.
Is this a bug? I don’t have non-permitted characters in my url. I have a % sign and some numbers (which are all specifically permitted). It’s definitely the permitted_uri_characters setting that’s giving me grief. If I add a quotation mark to it, it allows the %22 query through no problem.
And to be clear, the query is coming from a form as post data, then being encoded in my controller and then redirected to a new page. There’s no way that the permitted_uri_characters is somehow being applied BEFORE it gets encoded.
This is driving me batty, as my only solution at the moment is to open up my permitted_uri_charcters to everything under the sun, which isn't very secure!
Seems like you'd need to add # to the permitted_uri_chars, even if you urlencode the email before sending it to site_url(). Might urldecode it before watching up the characters ...
Percent Symbol in CodeIgniter URI
Here is a post more specific to your problem.
http://sholsinger.com/archive/2009/04/passing-email-addresses-in-urls-with-codeigniter/
I tried with the permitted_uri_chars, and finally ended up passing the email as a query string (?email=bla#bla.com), not even urlencoding it. Works great :)
Could it be URL encoding the %20 to a " before codeigniter verify' it? How about adding that to the permitted char's list.
I have my own solution for this, it's messy and not optimal, but it works. You can create a table where you store (search_string , url_title).
Every time you perform a search, save the string, generate an url_title() and save it to the database. This way, you can redirect your user to a safe url, without missing the initial search.
I know somebody is gonna yell at me for this solution. But, if your site is small, and your traffic keeps low, it's a valid solution.

Resources