How to get book cover picture through amazon API [duplicate] - amazon-product-api

This question already has an answer here:
How do I get a book graphic and description from the Amazon Book API?
3 answers
I want to get the cover of a book form its ASIN through Amazon API. I use the ItemLookup function, but I only get the author, manufacturer and the title.
ie :
<ItemAttributes>
<Author>Anna Gavalda</Author>
<Manufacturer>J'Ai Lu</Manufacturer>
<ProductGroup>Book</ProductGroup>
<Title>Ensemble, C'Est Tout (French Edition)</Title>
</ItemAttributes>

See How do I get a book graphic and description from the Amazon Book API?
Also, interesting article about using Amazon images here:
http://bibwild.wordpress.com/2008/03/19/think-you-can-use-amazon-api-for-library-service-book-covers/

You can try this:
$track=$_GET['title'];
// Call To Amazon Predefined Class
$client = new AmazonECS(AWS_API_KEY, AWS_API_SECRET_KEY, 'com', AWS_ASSOCIATE_TAG);
$response = $client->category('Books')->responseGroup('Images,Reviews,ItemAttributes,OfferSummary')->search($track);
// To Get Image
<img src="<?php echo $response->Items->Item[0]->LargeImage->URL ?>" width="233" height="300">

Related

yii2, display all translation page titles on the same page

Need to make a small mod to a yii2 project, as this site is available in multiple languages I want to display all translated page titles. So if im on the english version of a page i also want to get all of the translated titles of that page.
When I use
foreach (\Yii::$app->params['languageUrls'] as $code => $url) {
echo $url;
}
It only displays the current url.
If you refer to the texts that are translated via Yii::t():
http://www.yiiframework.com/doc-2.0/yii-baseyii.html#t()-detail
Following the example it would be:
$username = 'Alexander';
echo \Yii::t('app', 'Hello, {username}!', ['username' => $username], $language);
It is not clear from your question how the language and translation is organised in your Yii2 application. Possibly you have ActiveRecord models that contain language fields that are related to the main ActiveRecord models via a Has-Many relationship. In this case, you could refer to the main Model to find the appropriate functions. This however, is not in the Yii2 documentation or guide.

How to dynamically change the element definition of a region in content presenter template in Webcenter Portal?

I have been following Yannick Ongena's tutorial http://yonaweb.be/webcenter_tutorial/using_content_presenter_templates
I am looking to alter some code in the content presenter template "training-list-item.jsff" so that the region definition will have a dynamic value.
That is, rather than writing
<af:outputText value="#{node.propertyMap['RD_TRAINING:description'].asTextHtml}"
escape="false" id="ot5"/>
I am looking to write like
<af:outputText value="#{node.propertyMap['xRegionDefinition:description'].asTextHtml}"
escape="false" id="ot5"/>
Unfortunately, this does not work. If I write only "xRegionDefinition" within the propertyMap,it displays the region definition name in the portal, that is "RD_TRAINING". But I am looking to display the value of element definition within the region that is, the "description".
My objective is to display different region definitions at the portal rather than a hard coded fixed region. I have wrote some Java code also to dynamically change the CMIS query to supply a new value for the region definition:
if(news){
query = "SELECT * FROM ora:t:IDC:GlobalProfile WHERE ora:p:xRegionDefinition LIKE \'RD_TRAINING\'";
}
else
query = "SELECT * FROM ora:t:IDC:GlobalProfile WHERE ora:p:xRegionDefinition LIKE \'RD_SWEDISH\'";
Please help. Hope I am clear in explaining the requirement.
Why don't you use ADF Switcher component if you only have 2 options!
Check this video to know how to use it

Filter explicit images in google api

Hi i want to filter the explicit images when i run my application(in local and server).
how to i restrict the images which are containing adult images what should i do for restrict images using google custom search engine please anyone help me.
i am using below code but its not working.
<script type="text/javascript">
google.load('search', '1');
function initialize() {
var searchControl = new google.search.SearchControl();
searchControl.addSearcher(new google.search.ImageSearch());
searchControl.draw(document.getElementById("searchcontrol"));
searchControl.execute("sunset");
}
google.setOnLoadCallback(initialize);
</script>
You can use following code from this guide
var searcher = new google.search.ImageSearch();
searcher.setRestriction(
google.search.Search.RESTRICT_SAFESEARCH,
google.search.Search.SAFESEARCH_STRICT);
imageSearch.setSearchCompleteCallback ...
imageSearch.execute....
Also notice:
Adult filtering works only for few languages (please see it here)
This API marked as deprecated. Probably in future you should use some sort of this API. I am still using deprecated API, but in any time Google can disable this one.

Magento: How to display customer's phone number on customer information field

I’m trying to have the customer’s phone number show under the customer account information section. I know the phone number belongs to the customer address section but I’m trying to redesign how the customer account information looks like.
I added a new custom field for Customer ID and I’m able to display it by using the following code as the customer ID belongs to customer_entity.
<?php echo $this->__('Identification:') ?><?php echo $this->htmlEscape($this->getCustomer()->getCustid()) ?>
but now I’m trying to do the same for the telephone number by using this
<?php echo $this->__('Telephone:') ?><?php echo $this->htmlEscape($this->getCustomer()->getTelephone()) ?>
But it doesn’t display any data since it belongs to customer_address_entity and I BELIEVE it should be
->getAddress()->getTelephone()
instead of
->getCustomer()->getTelephone()
but using ->getAddress just gives me an error “ Call to a member function getTelephone() on a non-object “
Does anyone have any idea how to do this?
As a reference, I'm trying to have this data display on the file customer\account\dashboard\info.phtml
Thanks in advance.
Oh, thanks I'll post now! (see comments under original post).
Simply use the following:
$this->getCustomer()->getPrimaryBillingAddress()->getTelephone();
The first part will give you all the details, which you could then explore with var_dump() as per #paperids.
This answer should go to #Alex, but just for the sake of completion, I'm posting this as an answer:
Use:
$this->getCustomer()->getPrimaryBillingAddress()->getTelephone()
Luis has mentioned before that if customer didn't setup his billing address you will get an error in return:
Call to a member function in a non-object.
If you want to be ready for such situation you can put the code into following IF statement:
<?php if ($customerAddressId){ ?>
<?php $address=Mage::getModel('customer/address')->load($customerAddressId); ?>
<?php $this->getCustomer()->getPrimaryBillingAddress()->getTelephone();
} ?>
Careful if there is NO address set then this getPrimaryBillingAddress() return a non object.
$address = $this->getCustomer()->getPrimaryBillingAddress();
if ( $address ) echo $address->getTelephone();
isLoggedIn()) {
$customer = Mage::getSingleton('customer/session')->getCustomer();
$customerName = $customer->getName();
// like that you can access all other attributes
}
?>

Wordpress widget/plugin - content based on text of post(s)/page(s) visible?

I'm new to the Wordpress plugin and widget APIs, but I'm sure this is possible.
I'd like to make a plugin or widget that would create links to other posts or external sites based on certain keywords/tags in the content of the given page/post.
Is this possible?
For example, if a term is in all-caps, link to the Wiktionary definition; inside a <news>..</news> pair, go to Google's news search; etc.
This is definitely possible. Don't bother looking into the widget api for this. Look at the filter api. WordPress has an api that allows you to filter content before it's sent to the browser. In this case, you'd do something like this:
function my_super_awesome_content_filterer( $content ){
$content = preg_replace( '#([A-Z]+)#', '$1', $content );
}
add_filter( 'the_content', 'my_super_awesome_content_filterer' );
Read more about filters here:
http://codex.wordpress.org/Plugin_API#Filters

Resources