I need add #produc to my url. It must lokoks loke trololo.com/buy#apple. How i can do it in my controller? I can't understand where i must add it...
I read it https://github.com/symfony/symfony/issues/3910, but it don't help me. This not exacly what i need
$this->get('router')->generate('store', array('#' => $product->getSlug(), true),
Maybe someone faced with it? Please, help me to solved this problem
You have your answer in the link you provided. Fabien Potencier (Symfony2's creator) said that you need to append the anchor to the URL manually.
There is no need to that. Just append it after generating the URL.
Like so:
$url = $this->get('router')->generate('store') . '#' . $product->getSlug();
Related
I am trying to send the customer an invoice once an order has been placed, and the user reaches the thankyou page.
I thought i could use the following:
function sendinvoice($orderid)
{
$email = new WC_Email_Customer_Invoice();
$email->trigger($orderid);
}
add_action('woocommerce_thankyou','sendinvoice');
But on the thank you page i then see the following error:
Fatal error: Class 'WC_Email_Customer_Invoice' not found in /***/index.php on line 174
Any ideas on how i can resolve this?
it looks you need to specify the full path where 'WC_Email_Customer_Invoice' class is, you could either use require or include, for example:
include_once(WP_PLUGIN_DIR . 'woocommerce/includes/emails/class-wc-email-customer-invoice.php');
UPDATE: actually the best way to do it, is using global $woocommerce; and then just call it like this:
WC()->mailer()->emails['WC_Email_Customer_Invoice']->trigger($orderid);
Hope this helps!
You need to include these 2 files;
include_once('../wp-content/plugins/woocommerce/includes/emails/class-wc-email.php');
include_once('../wp-content/plugins/woocommerce/includes/emails/class-wc-email-customer-invoice.php');
UPDATED;
There is another dependent file;
include_once('../wp-content/plugins/woocommerce/includes/libraries/class-emogrifier.php');
I'm crawling a web page that's returning a redirect, so I'd like to add a configuration option into my crawler that that will let me set allow_redirects to false. Looking at the guzzle.readthedocs.org web page in regards to redirects, it says
$response = $client->get('http://github.com', ['allow_redirects' => false]);
echo $response->getStatusCode();
// 301
Since I am using Goutte with Symfony2, these commands are a little different. For example:
$client->getClient()->setDefaultOption('config/curl/'.CURLOPT_SSL_VERIFYHOST, FALSE);
Can anyone help me discover how I can add the guzzle allow_redirects to the configuration? I feel that this will help me to not get page content that I want and not a crawler full of redirect code.
Thanks!
Your question is, how to "translate" ['allow_redirects' => false] into Goutte-syntax?
Well, here's how to set up cURL options in Goutte: https://github.com/FriendsOfPHP/Goutte (search for "Fine-tune cURL options:")
And http://php.net/manual/en/function.curl-setopt.php gives you the name of the option you're looking for: CURLOPT_FOLLOWLOCATION
So putting it all together:
$client->getClient()->setDefaultOption('config/curl/'.CURLOPT_FOLLOWLOCATION, false;
If that's not what you asked for, please edit your question and clarify.
As we all know the WordPress' feed url is www.mysite.com/feed.
I have edited the feed-rss2.php file to show thumbnails if a certain GET parameter is passed. See the code below:
<?php if($_GET['c'] == 'detailswiththumb') echo the_post_thumbnail( array(100,100) ); ?>
But when I open the feed address like this:
www.mysite.com/feed?c=detailswiththumb
The code doesn't work. Can the arguments be passed this way? Am I missing something? Please help.
Firstly, the function is get_the_post_thumbnail() not the_post_thumbnail().
Then, their is one more problem in your code, that you have to pass the post id to get its thumbnail (for more info see http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail).
So, first you will have to extract the post id from somewhere and then only you would be able to get the thumbnail. But, I think it would be very tough, so try giving up this thought, for it would take you a lot of time and no living being is going to access that path.
There were browser cache issues. Even with Google Chrome's incognito window. Had to test it with passing fake arguments like...
www.mysite.com/feed?c=detailswiththumb&fakearguments=123
...to clear the cache. And the code is fine.
Sorry for wasting your time guys.
An issue has been noticed on one of our old sites running 2.4 where when the user creates a link in the CMS content, selecting an existing page to link to, the link is not being converted to the actual URL on the front end and all links are coming through in the format of <a href="[sitetree_link_id=12]">
What would be causing this and how do I fix it?
The tag looks like it's being set incorrectly. It should be [sitetree_link id=12], not [sitetree_link_id=12].
We later added support to the parser for [sitetree_link,id=12] so that links didn't need to contain spaces, but I can't recall if that's in 2.4 or only 3.0+.
Can you confirm that your WYSIWYG insertion is putting in that errant _? If so, you might want to checkout the handleaction_insert function in tiny_mce_imporvements.js to confirm that it has a line like so:
case 'internal':
href = '[sitetree_link id=' + this.elements.internal.value + ']';
If the inserted links don't actually have the errant _ but they aren't being parsed, then try checking your sapphire/_config.php file for this:
ShortcodeParser::get('default')->register('sitetree_link', array('SiteTree', 'link_shortcode_handler'));
If your site makes changes to the ShortcodeParser at all you might have inadvertently turned off sitetree_link support.
If all of that looks in order, perhaps the ShortcodeParser isn't being called for some reason. In HTMLText::forTemplate(), put a debug statement (I like die("I got here!");) to confirm that HTMLText::forTemplate() is actually getting called. If it's not, you might need to manually call it in some pre-processing of your Content variable. Instead of this:
$content = $this->Content;
Do this:
$content = $this->obj('Content')->forTemplate();
I hope that one of those answers help. Either way, it would be great if you could post back, so we could isolate what caused this. It might help us make the API easier to use in SilverStripe 3.1.
The print $content statement in page.tpl.php . I want to alter it but I can't figure out what/where is the source of the $content variable in page.tpl.php file.
I'd appreciate any help. Thanks.
the drupal version is 6,
This is the return value of menu_execute_active_handler(). You can't change it in Drupal 6. You need Drupal 7 hook_page_alter() for that. Now, preprocess helps a little, see http://api.drupal.org/api/drupal/includes--theme.inc/function/theme/6
chx's answer is correct. This is just a longer explanation.
$content depends on the URL or more precisely the region that calls the variable.
The URL could be something like node/10, taxonomy/term/1, etc. Each of these paths is associated with menu entry which has a callback function that generates the value of $content.
Take a look at the API docs for more info. http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_get_content/6
The ConTemplate module might provide the sort of control over $content that you are looking for. http://drupal.org/project/contemplate