UnSupportedEntityException when trying to create/render records containing slug extension - orocommerce

I am trying to implement slugs in my bundle, but when i try to create a record and run my message consumer i get the following error:
Unexpected exception occurred during Direct URL generation ["exception" => Oro\Bundle\RedirectBundle\Exception\UnsupportedEntityException { …}] ["processor" => "Oro\Bundle\RedirectBundle\Async\DirectUrlProcessor","message_id" => "oro.6256de2124b630.96491198","message_body" => ["createRedirect" => true,"id" => [3],"class" => "Phpro\OroBundleBlogBundle\Entity\BlogPostCategory"],"message_properties" => ["oro.message_queue.client.topic_name" => "oro.redirect.generate_direct_url.entity","oro.message_queue.client.queue_name" => "oro.default","oro.security.token" => "organizationId=1;userId=1;userClass=Oro\Bundle\UserBundle\Entity\User;roles=ROLE_ADMINISTRATOR"],"message_headers" => ["content_type" => "application/json","message_id" => "oro.6256de2124b630.96491198","timestamp" => "1649860129","priority" => "2"],"elapsed_time" => "34 ms","memory_usage" => "107.57 MB"]
The slugs are stored, but the use of the get_slug_urls_for_prototypes twig filter results in the following error An exception has been thrown during the rendering of a template (""). Again because of the UnsupportedEntityException
Am i missing some configuration?

As mentioned in the OroCommerce documentation the entity must implement the interface to support slugs. Make sure you fulfilled this requirement.

Related

Asp Net Core - Error persisting Value Object

I am trying to persist a value valuobject from address and I get the error below, I am using postgres and I already tried to map this class in several ways, I saw that some people had similar problems but I did not find the solution.
I only encounter this error when using ef core
System.InvalidOperationException: 'The entity of type 'EmpresaModel' is sharing the table 'Empresa.Empresa' with entities of type 'EnderecoEmpresa', but there is no entity of this type with the same key value that has been marked as 'Added'. Consider using 'DbContextOptionsBuilder.EnableSensitiveDataLogging' to see the key values.'
builder.OwnsOne(e => e.EnderecoEmpresa, a =>
{
a.Property(p => p.Bairro).HasMaxLength(50)
.HasColumnName("Bairro")
.HasDefaultValue("");
a.Property(p => p.CEP).HasMaxLength(10)
.HasColumnName("CEP")
.HasDefaultValue("");
a.Property(p => p.Complemento).HasMaxLength(60)
.HasColumnName("Complemento")
.HasDefaultValue("");
a.Property(p => p.IdMunicipio)
.HasColumnName("MunicipioId");
a.Property(p => p.IdUF)
.HasColumnName("UfId");
a.Property(p => p.Logradouro)
.HasColumnName("Logradouro").HasMaxLength(60)
.HasDefaultValue("");
a.Property(p => p.Numero)
.HasColumnName("Numero").HasMaxLength(10)
.HasDefaultValue("");
});

Shopify APP API

$shopify = shopify\client( $shop, $app_settings->api_key, $shop_data->access_token, false );
$products = $shopify('GET', '/admin/products.json', array('published_status' => 'published'));`
I am getting the following response by printing the $shopify:
Closure Object
(
[static] => Array
(
[base_uri] => https://4f4b14c3eb5464ae238dd6cf4b88bce6:c2608b7067c5bf96028876023114b68c#pilibaba.myshopify.com/
[oauth_token] => c2608b7067c5bf96028876023114b68c
[private_app] => 2f996f1bd2a0f4fb343703555c89a234
)
[parameter] => Array
(
[$method_uri] =>
[$query] =>
[$payload] =>
[&$response_headers] =>
[$request_headers] =>
[$curl_opts] =>
)
)
after that accessing the $product i am getting the following error.
Fatal error:
Uncaught phpish\shopify\CurlException: [3] malformed in /*****/shopify_app/shopify_app.php on line 36 thrown in /******/shopify_app/shopify.php on line 67
Is it a problem with my access token? as i do have all the store permission while installing the app.
I did research for this error by didnt find any help either from shopify support team.
change keys of your url:
apikey = c2608b7067c5bf96028876023114b68c
access_token = 4f4b14c3eb5464ae238dd6cf4b88bce6
https://c2608b7067c5bf96028876023114b68c:4f4b14c3eb5464ae238dd6cf4b88bce6#pilibaba.myshopify.com/admin/shop.json

RavenDB Query: Have to use Customize() instead of Include()

I'm getting an error that I'm exceeding the number of requests allowed per session (30) when using this query (using Include instead of Customize):
ApplicationServer appServer = QuerySingleResultAndSetEtag(session => session
.Include<ApplicationServer>(x => x.CustomVariableGroupIds)
.Include<ApplicationServer>(x => x.ApplicationIdsForAllAppWithGroups)
.Include<ApplicationServer>(x => x.CustomVariableGroupIdsForAllAppWithGroups)
.Include<ApplicationServer>(x => x.CustomVariableGroupIdsForGroupsWithinApps)
.Include<ApplicationServer>(x => x.InstallationEnvironmentId)
.Load <ApplicationServer>(id))
as ApplicationServer;
Note, the error occurs on this line, which is called for each AppWithGroup within an application:
appGroup.Application = QuerySingleResultAndSetEtag(session =>
session.Load<Application>(appGroup.ApplicationId)) as Application;
However, this query (using Customize) doesn't create extra requests:
ApplicationServer appServer = QuerySingleResultAndSetEtag(session =>
session.Query<ApplicationServer>()
.Customize(x => x.Include<ApplicationServer>(y => y.CustomVariableGroupIds))
.Customize(x => x.Include<ApplicationServer>(y => y.ApplicationIdsForAllAppWithGroups))
.Customize(x => x.Include<ApplicationServer>(y => y.CustomVariableGroupIdsForAllAppWithGroups))
.Customize(x => x.Include<ApplicationServer>(y => y.CustomVariableGroupIdsForGroupsWithinApps))
.Customize(x => x.Include<ApplicationServer>(y => y.InstallationEnvironmentId))
.Where(server => server.Id == id).FirstOrDefault())
as ApplicationServer;
However, the above query causes an error:
Attempt to query by id only is blocked, you should use call
session.Load("applications/2017"); instead of
session.Query().Where(x=>x.Id == "applications/2017");
You can turn this error off by specifying
documentStore.Conventions.AllowQueriesOnId = true;, but that is not
recommend and provided for backward compatibility reasons only.
I had to set AllowQueriesOnId = true because it was the only way I could get this to work.
What am I doing wrong in the first query to cause the includes not to work?
By the way, another post had the same issue where he had to use Customize. I'd like to do this correctly though.
I'm not sure why the load isn't doing this for you, What version of raven are you on? I just tested this in Raven 2.5 build 2700 and the include is bringing back the information for me in a single request.
Anyway, with the load not working quite like i would expect, i would switch to a set of lazy queries to get what you want in 2 server round trips. http://ravendb.net/docs/2.5/client-api/querying/lazy-operations.
Another option that might work out better for you, (depending on what you are really doing with all of that data) is a transformer. http://ravendb.net/docs/2.5/client-api/querying/results-transformation/result-transformers?version=2.5
Hope that helps.

Fetching Amazon buyback ("trade-in") price

Is there a way to get the Amazon buyback (aka "trade-in") prices for textbooks through an API? I've searched around for a while but can't find a clue how people are getting this for their websites..
Here is the Amazon BuyBack program: amazon.com/buyback
Here is an example buyback URL: http://www.amazon.com/gp/search/s/ref=tradeinavs?url=rh%3Dn%3A2205237011%26i%3Dtextbooks-tradein&field-keywords=978-0321614018&Go.x=10&Go.y=17
I'm aware that I could just fetch the pages and parse the HTML, but if there is some way to get it through an API or whatever, I'm sure Amazon would prefer that to just parsing the page (also it would be faster to query).
The Product Advertising API has it in the ItemAttributes section when you do an ItemLookup search, as shown by this sample call (I believe this is perl, but just to show you a sample):
my $request = {
Service => 'AWSECommerceService',
Operation => 'ItemLookup',
Version=>'2010-11-01',
ItemId => $itemId,
ResponseGroup => 'ItemAttributes',
};
snip
'ASIN' => '0136100570',
'ItemAttributes' => {
'NumberOfItems' => '1',
'IsEligibleForTradeIn' => '1',
'TradeInValue' => {
'Amount' => '3550',
'CurrencyCode' => 'USD',
'FormattedPrice' => '$35.50'
},
'ListPrice' => {
'Amount' => '18900',
'CurrencyCode' => 'USD',
'FormattedPrice' => '$189.00'
Source: https://forums.aws.amazon.com/message.jspa?messageID=212679

Magento api giving problem if image not exist

I am using magento api ..
in which i have used "catalog_product_attribute_media.create" ..thats giving problem if it doesn't get image on server where this image exist.
problem is that ..it stoping my script to run further
I have checked if URL is none.. but how can i handle this situation that is it getting url ...but image not exist
here is my code...
if($products[$counter]->small_image_url){//check if url exists
$newImage = array(
'file' => array(
'name' => 'file_name',
'content' => base64_encode(file_get_contents($products[$counter]->small_image_url)),
'mime' => 'image/jpeg'),
'label' => $products[$counter]->product_name,
'position' => 2,
'types' => array('thumbnail_image'),
'exclude' => 0
);
$imageFilename = $proxy->call($sessionId, 'product_media.create', array($sku, $newImage));
}
Have you tried checking for an empty string?
if($products[$counter]->small_image_url && $products[$counter]->small_image_url != '')